Skip to content

Instantly share code, notes, and snippets.

@jimmitchell
Created August 16, 2011 17:07
Show Gist options
  • Save jimmitchell/1149563 to your computer and use it in GitHub Desktop.
Save jimmitchell/1149563 to your computer and use it in GitHub Desktop.
CSS Button Style
/* css styles to create nice buttons out of anchor tags */
a.button {
border: 1px solid #bbb;
background: #ddd;
background: -webkit-gradient(linear, left top, left bottom, from(#eee), to(#ccc));
background: -moz-linear-gradient(top, #eee, #ccc);
padding: 6px 15px;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
-webkit-box-shadow: rgba(0,0,0,.1) 0 1px 1px;
-moz-box-shadow: rgba(0,0,0,.1) 0 1px 1px;
box-shadow: rgba(0,0,0,.1) 0 1px 1px;
text-shadow: rgba(255,255,255,1) 0 1px 1px;
color: #444;
font-size: 12px;
font-family: 'Lucida Grande', Helvetica, Arial, Sans-Serif;
text-decoration: none;
vertical-align: middle;
}
a.button:hover {
background: #ccc;
background: -webkit-gradient(linear, left top, left bottom, from(#f8f8f8), to(#bbb));
background: -moz-linear-gradient(top, #f8f8f8, #bbb);
color: #111;
border: 1px solid #aaa;
}
a.button:active {
background: #eee;
background: -webkit-gradient(linear, left top, left bottom, from(#fcfcfc), to(#d8dde2));
background: -moz-linear-gradient(top, #fcfcfc, #d8dde2);
border: 1px solid #bbb;
}
@jimmitchell
Copy link
Author

A CSS snippet that I use for "a" tag formatting when I want it to look like a button. Required adding a class tag of "button" to the anchor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment