Skip to content

Instantly share code, notes, and snippets.

@w3collective
Last active February 4, 2021 04:57
Show Gist options
  • Save w3collective/3e8eb372a918d9503e1568455d388c0d to your computer and use it in GitHub Desktop.
Save w3collective/3e8eb372a918d9503e1568455d388c0d to your computer and use it in GitHub Desktop.
Animated scrolling mouse icon with CSS
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Animated mouse scroll icon with CSS</title>
<style>
html {
height: 100%;
}
body {
background: #fff;
font-family: sans-serif;
display: flex;
justify-content: center;
align-items: center;
height: 100%;
}
.icon-scroll {
width: 20px;
height: 30px;
background: #ccc;
border: 2px solid #bbb;
border-radius: 10px;
display: flex;
justify-content: center;
margin: auto;
position: relative;
box-shadow: 3px 3px 5px -5px #000;
}
.icon-scroll::before {
content: "";
width: 4px;
height: 10px;
background: #eee;
border-radius: 2px;
margin-top: 5px;
}
.icon-scroll::after {
content: "";
width: 4px;
height: 3px;
background-color: #bbb;
position: absolute;
display: block;
animation: scroll ease 1s infinite;
}
@keyframes scroll {
from {
top: 5px;
}
to {
top: 18px;
}
100% {
opacity: 0;
}
}
</style>
</head>
<body>
<div class="icon-scroll"></div>
</body>
</html>
@w3collective
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment