Last Updated: February 18, 2020
· benjamincharity

Reset CSS to browser defaults.

Ever need to embed your styled content into the wild without the luxury of an iFrame? If you write OOCSS like I do, you will probably find yourself running into nasty specificity issues as most websites out there are coded quite poorly. Every ID and element selector will crush your sexy class selector without fail. This will give you a sweet reset to the browser defaults (not a normalized reset like normalize.css etc).

(Don't forget to namespace this!)



* {

  /* CSS2 Spec defaults for older browsers */
  background-attachment: scroll;
  background-color: transparent;
  background-image: none;
  background-position: 0% 0%;
  background-repeat: repeat;
  border-collapse: separate;
  border-spacing: 0;
  border-style: none;
  border-width: medium;
  bottom: auto;
  caption-side: top;
  clear: none;
  clip: auto;
  content: normal;
  counter-increment: none;
  counter-reset: none;
  cursor: auto;
  direction: ltr;
  display: inline;
  empty-cells: show;
  float: none;
  font-size: medium;
  font-style: normal;
  font-variant: normal;
  font-weight: normal;
  height: auto;
  left: auto;
  letter-spacing: normal;
  line-height: normal;
  list-style-image: none;
  list-style-position: outside;
  list-style-type: disc;
  margin: 0;
  max-height: none;
  max-width: none;
  min-height: 0;
  min-width: 0;
  opacity: 1;
  orphans: 2;
  outline-color: invert;
  outline-style: none;
  outline-width: medium;
  overflow: visible;
  padding: 0;
  page-break-after: auto;
  page-break-before: auto;
  page-break-inside: auto;
  position: static;
  right: auto;
  table-layout: auto;
  text-align: left;
  text-decoration: none;
  text-indent: 0;
  text-transform: none;
  top: auto;
  unicode-bidi: normal;
  vertical-align: baseline;
  visibility: visible;
  white-space: normal;
  widows: 2;
  width: auto;
  word-spacing: normal;
  z-index: auto;

  /* Initial for newer browsers */
  /* */
  all: initial;


1 Response
Add your response

Thank your for sharing Benjamin. :)

  • Prerak.
over 1 year ago ·