Clickable 3D Button
Clickable 3D Button made by Simon George. Clever use of borders on pseudo elements :before
and :after
to achieve the edges (3D Nature).
<div class="button3D">Click me</div>
<div class="button3D">Click me</div>
html {
html {
background: #deddad; /* Old browsers */
background: linear-gradient(top, #deddad 0%, #f3f3d8 100%); /* FF3.6+ */
background: gradient(linear, left top, left bottom, color-stop(0%,#deddad), color-stop(100%,#f3f3d8)); /* Chrome,Safari4+ */
background: linear-gradient(top, #deddad 0%,#f3f3d8 100%); /* Chrome10+,Safari5.1+ */
background: linear-gradient(top, #deddad 0%,#f3f3d8 100%); /* Opera11.10+ */
background: linear-gradient(top, #deddad 0%,#f3f3d8 100%); /* IE10+ */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#DEDDAD', endColorstr='#F3F3D8',GradientType=0 ); /* IE6-9 */
background: linear-gradient(top, #deddad 0%,#f3f3d8 100%); /* W3C */
height: 100%;
}
body {
font-family: 'Lucida Grande', 'Helvetica Neue', sans-serif;
font-size: 13px;
height: 100%;
}
.button3D {
position: relative;
display: block;
width: 200px;
height: 50px;
top: 50%;
left: 50%;
margin-top: -25px;
margin-left: -100px;
background: #650404;
font-family: sans-serif;
text-align: center;
line-height: 50px;
font-size: 24px;
color: #fff;
text-shadow: 0 -1px rgba(0, 0, 0, 0.5);
border: 1px solid #4e0202;
box-shadow: 0 5px 15px -5px #222;
box-shadow: 0 5px 15px -5px #222;
box-shadow: 0 5px 15px -5px #222;
user-select: none;
user-select: none;
user-select: none;
cursor: pointer;
}
.button3D:before {
content: "";
position: absolute;
top: -9px;
left: 0px;
width: 178px;
height: 0px;
border: 11px solid transparent;
border-bottom: 8px solid #650404;
border-top: 0;
}
.button3D:after {
content: "";
color: #c56338;
line-height: 180px;
font-size: 16px;
position: absolute;
top: -8px;
left: 1px;
width: 178px;
height: 0px;
border: 10px solid transparent;
border-bottom: 7px solid #891414;
border-top: 0;
}
.button3D:active {
width: 158px;
height: 41px;
top: 50%;
left: 50%;
margin-top: -33px;
margin-left: -79px;
line-height: 36px;
font-size: 22px;
color: #eee;
text-shadow: 0 -1px rgba(0, 0, 0, 0.5);
border: 1px solid #3c0101;
background: #4e0202;
border-top: 0;
box-shadow: 0 0 0 0;
box-shadow: 0 0 0 0;
box-shadow: 0 0 0 0;
}
.button3D:active:before {
top: 0;
height: 42px;
width: 158px;
left: -12px;
padding: 0 1px;
border: 11px solid #b3b294;
border-bottom: 8px solid #deddad;
border-top: 0;
}
.button3D:active:after {
content: "";
top: 0;
height: 50px;
width: 182px;
left: -13px;
border: 0;
box-shadow: 0 15px 25px -15px rgba(0,0,0,0.5) inset;
box-shadow: 0 15px 25px -15px rgba(0,0,0,0.5) inset;
box-shadow: 0 15px 25px -15px rgba(0,0,0,0.5) inset;
}