Skip to content

Instantly share code, notes, and snippets.

@kyleparisi
Created July 22, 2016 17:58
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 kyleparisi/20e37b90e572e9d26882cd6ba67fd173 to your computer and use it in GitHub Desktop.
Save kyleparisi/20e37b90e572e9d26882cd6ba67fd173 to your computer and use it in GitHub Desktop.
Pure css material button click
.btn {
position: absolute;
top: 50%;
left: 50%;
transform: translate3d(-50%, -50%, 0);
padding: 1em 2em;
background-color: #3498db;
border-radius: 3px;
color: #fff;
font-family: 'Roboto', sans-serif;
cursor: pointer;
overflow: hidden;
box-shadow: 0 2px 0 #2980b9;
}
.btn:hover, .btn:focus {
/*background-color: #27ae60;*/
}
.btn > * {
position: relative;
}
.btn span {
display: block;
padding: 12px 24px;
}
.btn:before {
content: "";
position: absolute;
top: 50%;
left: 50%;
display: block;
width: 0;
height: 100%;
padding-top: 0;
border-radius: 100%;
background-color: rgba(236, 240, 241, .3);
-webkit-transform: translate(-50%, -50%);
-moz-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
-o-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
.btn:active:before {
width: 120%;
padding-top: 120%;
transition: width .1s ease-out, padding-top .1s ease-out;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment