Skip to content

Instantly share code, notes, and snippets.

@zeraphie
Created November 11, 2016 13:55
Show Gist options
  • Save zeraphie/f14c6e4a61ead338939da7d95389c37e to your computer and use it in GitHub Desktop.
Save zeraphie/f14c6e4a61ead338939da7d95389c37e to your computer and use it in GitHub Desktop.
Really simple pure css arrow
<div class="arrow"></div>
body {
margin: 0;
}
// Position it centrally
.arrow {
left: 50%;
position: fixed;
top: 50%;
transform: translate3d(-50%,-50%,0px);
}
// The actual arrow styles, make it an area for 50x50 for ease of use on touch devices
.arrow {
background: #f3f3f3;
cursor: pointer;
height: 50px;
width: 50px;
&:before {
border-top: 3px solid #333;
border-right: 3px solid #333;
box-sizing: border-box;
content: '';
height: 16px;
left: 50%;
position: absolute;
top: 50%;
transform: translate3d(-50%, -75%, 0px) rotate(135deg);
// Uncomment if you want it to move (probably better not to, looks weird)
// transition: transform 0.3s;
// will-change: transform;
width: 16px;
}
// The 'flip' state, just on hover for ease atm
&:hover:before {
transform: translate3d(-50%, -25%, 0px) rotate(-45deg);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment