Skip to content

Instantly share code, notes, and snippets.

@AntonTrollback
Last active December 14, 2015 19:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AntonTrollback/5135809 to your computer and use it in GitHub Desktop.
Save AntonTrollback/5135809 to your computer and use it in GitHub Desktop.
/* Icon */
.icon {
display: block;
width: 32px;
height: 32px;
margin: 50px;
border-radius: 3px;
background: CornflowerBlue;
position: relative;
overflow: hidden;
}
/* "shine" element */
/* Could be a pseudo element but they lack support for CSS transitions in some browsers */
.icon .icon-effect {
position: absolute;
top: -110%;
left: -210%;
width: 200%;
height: 200%;
opacity: 0;
background: rgba(255, 255, 255, 0.2);
background: -moz-linear-gradient(
left,
rgba(255, 255, 255, 0.1) 0%,
rgba(255, 255, 255, 0.1) 75%,
rgba(255, 255, 255, 0.5) 90%,
rgba(255, 255, 255, 0.0) 100%
);
background: -webkit-linear-gradient(
top,
rgba(255, 255, 255, 0.1) 0%,
rgba(255, 255, 255, 0.1) 75%,
rgba(255, 255, 255, 0.5) 90%,
rgba(255, 255, 255, 0.0) 100%
);
background: -webkit-gradient(
linear, left top, right top,
color-stop(0% ,rgba(255, 255, 255, 0.2)),
color-stop(75% ,rgba(255, 255, 255, 0.2)),
color-stop(90% ,rgba(255, 255, 255, 0.8)),
color-stop(100%,rgba(255, 255, 255, 0.0))
);
background: -o-linear-gradient(
top,
rgba(255, 255, 255, 0.1) 0%,
rgba(255, 255, 255, 0.1) 75%,
rgba(255, 255, 255, 0.5) 90%,
rgba(255, 255, 255, 0.0) 100%
);
background: -ms-linear-gradient(
top,
rgba(255, 255, 255, 0.1) 0%,
rgba(255, 255, 255, 0.1) 75%,
rgba(255, 255, 255, 0.5) 90%,6
rgba(255, 255, 255, 0.0) 100%
);
background: linear-gradient(
top,
rgba(255, 255, 255, 0.1) 0%,
rgba(255, 255, 255, 0.1) 75%,
rgba(255, 255, 255, 0.5) 90%,
rgba(255, 255, 255, 0.0) 100%
);
-webkit-transform: rotate(30deg);
-moz-transform: rotate(30deg);
-ms-transform: rotate(30deg);
-o-transform: rotate(30deg);
transform: rotate(30deg);
-webkit-transition-property: left, top, opacity;
-moz-transition-property: left, top, opacity;
-ms-transition-property: left, top, opacity;
-o-transition-property: left, top, opacity;
transition-property: left, top, opacity;
-webkit-transition-duration: 0.5s, 0.5s, 0.1s;
-moz-transition-duration: 0.5s, 0.5s, 0.1s;
-ms-transition-duration: 0.5s, 0.5s, 0.1s;
-o-transition-duration: 0.5s, 0.5s, 0.1s;
transition-duration: 0.5s, 0.5s, 0.1s;
-webkit-transition-timing-function: ease;
-moz-transition-timing-function: ease;
-ms-transition-timing-function: ease;
-o-transition-timing-function: ease;
transition-timing-function: ease;
}
/* Hover state - trigger effect */
.icon:hover .icon-effect {
opacity: 1;
top: -30%;
left: -30%;
}
/* Active state */
.icon:active .icon-effect {
opacity: 0;
}
<a href="#" class="icon">
<span class="icon-effect"></span>
</a>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment