Skip to content

Instantly share code, notes, and snippets.

@mctep
Created February 21, 2013 12:52
Show Gist options
  • Save mctep/5004542 to your computer and use it in GitHub Desktop.
Save mctep/5004542 to your computer and use it in GitHub Desktop.
Untitled
body,
html {
padding: 0;
margin: 0;
height: 100%;
}
.page {
position: relative;
height: 100%;
background: #666;
text-align: center;
}
.page__pseudo,
.page__content {
display: inline-block;
vertical-align: middle;
}
.page__pseudo {
width: 0;
height: 100%;
}
.cool-button {
cursor: pointer;
display: inline-block;
position: relative;
overflow: hidden;
background-color: #222;
width: 90px;
height: 125px;
-webkit-border-radius: 6px;
border-radius: 6px;
-webkit-box-shadow: 0 0 3px #000, inset 0 -1px 1px -1px rgba(255,255,255,0.4), inset 0 3px 3px -3px rgba(255,255,255,0.4);
box-shadow: 0 0 3px #000, inset 0 -1px 1px -1px rgba(255,255,255,0.4), inset 0 3px 3px -3px rgba(255,255,255,0.4);
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
opacity: 0.99999;
-ms-filter: none;
filter: none;
-webkit-transition: opacity 0.2s;
-moz-transition: opacity 0.2s;
-o-transition: opacity 0.2s;
-ms-transition: opacity 0.2s;
transition: opacity 0.2s;
}
.cool-button:after {
content: '';
position: absolute;
height: 100%;
width: 100%;
left: 0;
top: 0;
-webkit-border-radius: 6px;
border-radius: 6px;
opacity: 0.5;
-ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=50);
filter: alpha(opacity=50);
z-index: 1;
background-image: -webkit-radial-gradient(50% 0%, circle, rgba(255,255,255,0.8) 25%, rgba(255,255,255,0.6) 45%, rgba(255,255,255,0.5) 58%, rgba(255,255,255,0) 60%);
background-image: -moz-radial-gradient(50% 0%, circle, rgba(255,255,255,0.8) 25%, rgba(255,255,255,0.6) 45%, rgba(255,255,255,0.5) 58%, rgba(255,255,255,0) 60%);
background-image: -ms-radial-gradient(50% 0%, circle, rgba(255,255,255,0.8) 25%, rgba(255,255,255,0.6) 45%, rgba(255,255,255,0.5) 58%, rgba(255,255,255,0) 60%);
background-image: radial-gradient(50% 0%, circle, rgba(255,255,255,0.8) 25%, rgba(255,255,255,0.6) 45%, rgba(255,255,255,0.5) 58%, rgba(255,255,255,0) 60%);
background-repeat: no-repeat;
}
.cool-button__text,
.cool-button__text_pseudo {
display: inline-block;
vertical-align: middle;
}
.cool-button__text_pseudo {
height: 100%;
}
.cool-button__text {
font-size: 32px;
font-weight: bold;
font-family: sans-serif;
color: #999;
text-shadow: 0 2px #000;
}
.cool-button__lump {
position: relative;
z-index: 2;
width: 60%;
height: 16px;
-webkit-transition: all 0.2s linear;
-moz-transition: all 0.2s linear;
-o-transition: all 0.2s linear;
-ms-transition: all 0.2s linear;
transition: all 0.2s linear;
top: 16px;
left: 20%;
-webkit-border-radius: 6px;
border-radius: 6px;
-webkit-box-shadow: inset 0 -2px 1px -1px rgba(255,255,255,0.3), inset 0 2px 1px -1px rgba(255,255,255,0.3);
box-shadow: inset 0 -2px 1px -1px rgba(255,255,255,0.3), inset 0 2px 1px -1px rgba(255,255,255,0.3);
background-color: #000;
background-image: -webkit-radial-gradient(50% 100%, rgba(255,255,255,0.24) 10%, rgba(255,255,255,0) 90%);
background-image: -moz-radial-gradient(50% 100%, rgba(255,255,255,0.24) 10%, rgba(255,255,255,0) 90%);
background-image: -ms-radial-gradient(50% 100%, rgba(255,255,255,0.24) 10%, rgba(255,255,255,0) 90%);
background-repeat: no-repeat;
}
.cool-button:hover {
opacity: 0.9;
-ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=90);
filter: alpha(opacity=90);
}
.cool-button:hover .cool-button__lump {
background-color: #236787;
-webkit-box-shadow: inset 0 1px 2px rgba(0,0,0,0.2), 0 1px 1px -1px rgba(255,255,255,0.5);
box-shadow: inset 0 1px 2px rgba(0,0,0,0.2), 0 1px 1px -1px rgba(255,255,255,0.5);
}
<!DOCTYPE html><html><head><link rel="stylesheet" href="/stylesheets/cool-buttons.css"></head><body><div class="page"><div class="page__pseudo"></div><div class="page__content"><div class="cool-button"><div class="cool-button__lump"></div><div class="cool-button__text_pseudo"></div><div class="cool-button__text">ON</div></div></div></div></body></html><!-- content to be placed inside <body>…</body> -->
// alert('Hello world!');
{"view":"split-vertical","fontsize":"100","seethrough":"","prefixfree":"1","page":"css"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment