Skip to content

Instantly share code, notes, and snippets.

@ian128K
Created September 21, 2014 07:23
Show Gist options
  • Save ian128K/ed270133e7d8d3bda0e5 to your computer and use it in GitHub Desktop.
Save ian128K/ed270133e7d8d3bda0e5 to your computer and use it in GitHub Desktop.
Pure CSS button
<!-- do not change the markup -->
<!--[if gte IE 9]>
<style type="text/css">
.gradient {
filter: none;
}
</style>
<![endif]-->
<div>
<a href="#">Checkout</a>
</div>
/*
INSTRUCTIONS
Using CSS properties alone, recreate this button:
http://i.imgur.com/gnZnY.png.
Spend no longer than 15 minutes on it, we don't
expect it to be a perfect match. It's open book,
feel free to hit Google but be prepared to
explain your solution.
*/
div {
margin: 7em 33em;
}
a {
padding: 0.7em;
font: bold 1.35em "Helvetica";
text-decoration: none;
text-transform: uppercase;
text-shadow: 1px 0 0 #eee;
color: #666;
background: #eee; /* Old browsers */
/* IE9 SVG, needs conditional override of 'filter' to 'none' */
background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2VlZWVlZSIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiNjY2NjY2MiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+);
/* FF3.6+ */
background: -moz-linear-gradient(top, #eee 0%, #ccc 100%);
/* Chrome,Safari4+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#eee), color-stop(100%,#ccc));
/* Chrome10+,Safari5.1+ */
background: -webkit-linear-gradient(top, #eee 0%,#ccc 100%);
/* Opera 11.10+ */
background: -o-linear-gradient(top, #eee 0%,#ccc 100%);
/* IE10+ */
background: -ms-linear-gradient(top, #eee 0%,#ccc 100%);
/* W3C */
background: linear-gradient(to bottom, #eee 0%,#ccc 100%);
/* IE6-8 */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eee', endColorstr='#ccc',GradientType=0 );
border-radius: 10px;
box-shadow:
0 1px 4px 1px #999,
0 0 0 7px #ccc,
0 0 0 9px #fff,
0 0 0 11px #444;
}
a:before, a:after {
content: "\2605";
color: #868686;
text-shadow: 1px 0 0 #eee;
}
a:before {
padding-right: 0.5em;
}
a:after {
padding-left: 0.5em;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment