Skip to content

Instantly share code, notes, and snippets.

@jimmydo
Created July 24, 2011 22:37
Show Gist options
  • Save jimmydo/1103197 to your computer and use it in GitHub Desktop.
Save jimmydo/1103197 to your computer and use it in GitHub Desktop.
Reset styling of button-like elements
a,
button,
input[type="button"],
input[type="submit"] {
background-color: #ccc;
line-height: normal; /* since Firefox forces <button> and <input> elements to always have a line height of 'normal', we do the same for all button-like elements for consistency */
padding: 6px 12px;
}
a {
color: inherit; /* inherit text color of parent element instead of using the usual hyperlink color */
display: inline-block; /* ensure proper height */
text-decoration: none; /* remove underline */
}
button,
input[type="button"],
input[type="submit"] {
border: 0; /* remove default button styling */
cursor: pointer; /* change cursor when hovering over button */
font-family: inherit; /* use font family of parent element */
font-size: inherit; /* use font size of parent element */
margin: 0;
}
/* remove extra button padding in Firefox */
button::-moz-focus-inner,
input[type="button"]::-moz-focus-inner,
input[type="submit"]::-moz-focus-inner {
border: 0;
padding: 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment