Simple, Purely CSS3 Buttons
CSS buttons in web design is not a new thing, but by using CSS3 properties like gradients, box shadows, text shadows, transitions and even animations we can make rich buttons with plain CSS.
Below are a few really simply CSS buttons, these buttons are best viewed in Firefox, Chrome and Safari and the animation in Button Two only works in Firefox. The CSS for each of these buttons is below the only HTML needed is the addition of one class to your button (span, div, a, and so on), i.e. add a class of button-one to your anchor link and that's it. Feel free to use them on your own site.
| Click Here |
Special |
Click Here |
Click Here |
Button One
|
Button Two
|
Button Three
|
Button Four
|
Button One CSS
.button-one {
background: #15668C; /* Old browsers */
background: -moz-linear-gradient(top, #15668C 0%, #072838 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#15668C), color-stop(100%,#072838)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #15668C 0%,#072838 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #15668C 0%,#072838 100%); /* Opera11.10+ */
background: -ms-linear-gradient(top, #15668C 0%,#072838 100%); /* IE10+ */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#15668C', endColorstr='#072838',GradientType=0 ); /* IE6-9 */
background: linear-gradient(top, #15668C 0%,#072838 100%); /* W3C */
color: #fff;
padding: 0.3em 0.8em;
border: 1px solid #137199;
box-shadow: 0px 2px 2px rgba(0,0,0,1), 1px 0px 1px rgba(0,0,0,0.5) inset, -2px 2px 1px rgba(255,255,255,0.2) inset;
cursor: pointer;
text-shadow: 1px 1px 1px rgba(0,0,0,0.5);
font-size: 25px;
border-radius: 8px;
font-weight: bold;
-moz-transition: box-shadow 0.2s ease;
-o-transition: box-shadow 0.2s ease;
-webkit-transition: box-shadow 0.2s ease;
-ms-transition: box-shadow 0.2s ease;
transition: box-shadow 0.2s ease;
}
.button-one:hover {
background: #1B739B; /* Old browsers */
background: -moz-linear-gradient(top, #1B739B 0%, #072838 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#1B739B), color-stop(100%,#072838)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #1B739B 0%,#072838 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #1B739B 0%,#072838 100%); /* Opera11.10+ */
background: -ms-linear-gradient(top, #1B739B 0%,#072838 100%); /* IE10+ */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#1B739B', endColorstr='#072838',GradientType=0 ); /* IE6-9 */
background: linear-gradient(top, #1B739B 0%,#072838 100%); /* W3C */
box-shadow: 0px 2px 3px rgba(0,0,0,1), 1px 0px 1px rgba(0,0,0,0.4) inset, -2px 2px 1px rgba(255,255,255,0.3) inset;
}
.button-one:active {
box-shadow: 0 1px 1px #000000, 1px 0 1px rgba(0, 0, 0, 0.6) inset, -2px 2px 1px rgba(255, 255, 255, 0.5) inset;
}
Button Two CSS
.button-two {
position: relative;
background: #910000; /* Old browsers */
background: -moz-linear-gradient(top, #910000 0%, #700000 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#910000), color-stop(100%,#700000)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #910000 0%,#700000 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #910000 0%,#700000 100%); /* Opera11.10+ */
background: -ms-linear-gradient(top, #910000 0%,#700000 100%); /* IE10+ */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#910000', endColorstr='#700000',GradientType=0 ); /* IE6-9 */
background: linear-gradient(top, #910000 0%,#700000 100%); /* W3C */
border: 1px solid #A30000;
border-radius: 8px 8px 8px 8px;
box-shadow: 0 2px 2px #000000, 1px 0 1px rgba(0, 0, 0, 0.5) inset, -2px 2px 1px rgba(255, 255, 255, 0.2) inset;
color: #FFFFFF;
cursor: pointer;
font-size: 25px;
font-weight: bold;
padding: 0.3em 0.8em 0.3em 1.8em;
text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.5);
-moz-transition: box-shadow 0.2s ease;
-o-transition: box-shadow 0.2s ease;
-webkit-transition: box-shadow 0.2s ease;
-ms-transition: box-shadow 0.2s ease;
transition: box-shadow 0.2s ease;
}
.button-two:before {
content: "\2605";
position: absolute;
left: 0.3em;
top: 0.3em;
position: absolute;
}
.button-two:hover {
background: #AD0000; /* Old browsers */
background: -moz-linear-gradient(top, #AD0000 0%, #700000 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#AD0000), color-stop(100%,#700000)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #AD0000 0%,#700000 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #AD0000 0%,#700000 100%); /* Opera11.10+ */
background: -ms-linear-gradient(top, #AD0000 0%,#700000 100%); /* IE10+ */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#AD0000', endColorstr='#700000',GradientType=0 ); /* IE6-9 */
background: linear-gradient(top, #AD0000 0%,#700000 100%); /* W3C */
box-shadow: 0px 2px 3px rgba(0,0,0,1), 1px 0px 1px rgba(0,0,0,0.4) inset, -2px 2px 1px rgba(255,255,255,0.3) inset;
}
.button-two:hover:before {
-moz-animation: spin 1s infinite linear;
-webkit-animation: spin 1s infinite linear;
-ms-animation: spin 1s infinite linear;
animation: spin 1s infinite linear;
}
@-moz-keyframes spin {
from { -moz-transform: rotate(0deg) scale(1) skew(0deg) translate(0px); }
to { -moz-transform: rotate(360deg) scale(1) skew(0deg) translate(0px); }
}
@-webkit-keyframes spin {
from { -webkit-transform: rotate(0deg) scale(1) skew(0deg) translate(0px); }
to { -webkit-transform: rotate(360deg) scale(1) skew(0deg) translate(0px); }
}
@-ms-keyframes spin {
from { -ms-transform: rotate(0deg) scale(1) skew(0deg) translate(0px); }
to { -ms-transform: rotate(360deg) scale(1) skew(0deg) translate(0px); }
}
@keyframes spin {
from { transform: rotate(0deg) scale(1) skew(0deg) translate(0px); }
to { transform: rotate(360deg) scale(1) skew(0deg) translate(0px); }
}
.button-two:active {
box-shadow: 0 1px 1px #000000, 1px 0 1px rgba(0, 0, 0, 0.6) inset, -2px 2px 1px rgba(255, 255, 255, 0.5) inset;
}
Button Three CSS
.button-three {
position:relative;
background: #7FBF00; /* Old browsers */
background: -moz-linear-gradient(top, #7FBF00 0%, #588400 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#7FBF00), color-stop(100%,#588400)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #7FBF00 0%,#588400 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #7FBF00 0%,#588400 100%); /* Opera11.10+ */
background: -ms-linear-gradient(top, #7FBF00 0%,#588400 100%); /* IE10+ */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#7FBF00', endColorstr='#588400',GradientType=0 ); /* IE6-9 */
background: linear-gradient(top, #7FBF00 0%,#588400 100%); /* W3C */
border: 1px solid #84C600;
border-radius: 8px 8px 8px 8px;
box-shadow: 0 2px 2px #000000, 1px 0 1px rgba(0, 0, 0, 0.5) inset, -2px 2px 1px rgba(255, 255, 255, 0.2) inset;
color: #FFFFFF;
cursor: pointer;
font-size: 25px;
font-weight: bold;
padding: 0.3em 0.8em;
text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.5);
-moz-transition: box-shadow 0.2s ease;
-o-transition: box-shadow 0.2s ease;
-webkit-transition: box-shadow 0.2s ease;
-ms-transition: box-shadow 0.2s ease;
transition: box-shadow 0.2s ease;
}
.button-three:before {
content: "for more information";
position: absolute;
top: -2em;
width: 100%;
left: 0;
text-align: center;
background: #eee;
color: #444;
text-shadow: 1px 1px 1px #fff;
font-size: 16px;
font-weight: normal;
border-top: 1px solid #dfdfdf;
}
.button-three:after {
content: "";
border-top: 5px solid #ededed;
border-left: 5px solid transparent;
border-right: 5px solid transparent;
position: absolute;
left: 48%;
top: -27%;
}
.button-three:hover {
background: #89CE00; /* Old browsers */
background: -moz-linear-gradient(top, #89CE00 0%, #588400 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#89CE00), color-stop(100%,#588400)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #89CE00 0%,#588400 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #89CE00 0%,#588400 100%); /* Opera11.10+ */
background: -ms-linear-gradient(top, #89CE00 0%,#588400 100%); /* IE10+ */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#89CE00', endColorstr='#588400',GradientType=0 ); /* IE6-9 */
background: linear-gradient(top, #89CE00 0%,#588400 100%); /* W3C */
box-shadow: 0px 2px 3px rgba(0,0,0,1), 1px 0px 1px rgba(0,0,0,0.4) inset, -2px 2px 1px rgba(255,255,255,0.3) inset;
}
.button-three:active {
box-shadow: 0 1px 1px #000000, 1px 0 1px rgba(0, 0, 0, 0.6) inset, -2px 2px 1px rgba(255, 255, 255, 0.5) inset;
}
Button Four CSS
.button-four {
position:relative;
background: #CECECE; /* Old browsers */
background: -moz-linear-gradient(top, #CECECE 0%, #999999 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#CECECE), color-stop(100%,#999999)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #CECECE 0%,#999999 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #CECECE 0%,#999999 100%); /* Opera11.10+ */
background: -ms-linear-gradient(top, #CECECE 0%,#999999 100%); /* IE10+ */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#CECECE', endColorstr='#999999',GradientType=0 ); /* IE6-9 */
background: linear-gradient(top, #CECECE 0%,#999999 100%); /* W3C */
color: #fff;
padding: 0.3em 0.8em;
border: 1px solid #c5c5c5;
box-shadow: 0px 2px 2px rgba(0,0,0,1), 1px 0px 1px rgba(0,0,0,0.5) inset, -2px 2px 1px rgba(255,255,255,0.2) inset;
cursor: pointer;
text-shadow: 1px 1px 1px rgba(0,0,0,0.5);
font-size: 25px;
border-radius: 8px;
font-weight: bold;
-moz-transition: all 0.2s ease;
-o-transition: all 0.2s ease;
-webkit-transition: all 0.2s ease;
-ms-transition: all 0.2s ease;
transition: all 0.2s ease;
}
.button-four:before {
content: "\2714";
position: absolute;
font-weight: normal;
left: 0.4em;
color: #444;
text-shadow: 1px 1px 1px #FFFFFF;
top: 0.3em;
width: 0;
display: none;
}
.button-four:hover {
background: #dfdfdf; /* Old browsers */
background: -moz-linear-gradient(top, #dfdfdf 0%, #999999 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#dfdfdf), color-stop(100%,#999999)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #dfdfdf 0%,#999999 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #dfdfdf 0%,#999999 100%); /* Opera11.10+ */
background: -ms-linear-gradient(top, #dfdfdf 0%,#999999 100%); /* IE10+ */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#dfdfdf', endColorstr='#999999',GradientType=0 ); /* IE6-9 */
background: linear-gradient(top, #dfdfdf 0%,#999999 100%); /* W3C */
box-shadow: 0px 2px 3px rgba(0,0,0,1), 1px 0px 1px rgba(0,0,0,0.4) inset, -2px 2px 1px rgba(255,255,255,0.3) inset;
color: #333;
text-shadow: 1px 1px 1px #fff;
padding-left: 1.5em;
}
.button-four:hover:before {
display: block;
}
.button-four:active {
box-shadow: 0 1px 1px #000000, 1px 0 1px rgba(0, 0, 0, 0.6) inset, -2px 2px 1px rgba(255, 255, 255, 0.5) inset;
}