FIreHAzaR:-D CRiB

This is not a blog. This is my diary.

My stylesheet and the why

:points: @ title, that was named "reset stylesheet and the why", to the fear of google crawler might picked that up, I changed it.

What is reset stylesheet?

I'll be collecting reset stylesheet, in preparation if I'm going to need them later.

Reset stylesheet is a way to make our site appear the same in all known web browser (not dead ones hopefully).

I know I have to think of html markup as contextual information rather than data caged by some rigid form. I am fine with my page displayed differently across web browser. But for a case where web browser default stylesheet hurt my aesthetic feeling, I need a weapon to fight them back.

I am not just collecting resets, I need to also document why the reset is necessary. This will take time, and luck. XD

So here are the list.

html, body, div, span, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre,abbr, address, cite, code, del, dfn, em, img, ins, kbd, q, samp,small, strong, sub, sup, var,b, i,dl, dt, dd, ol, ul, li,fieldset, form, label, legend,table, caption, tbody, tfoot, thead, tr, th, td,article, aside, canvas, details, figcaption, figure, footer, header, hgroup, menu, nav, section, summary,time, mark, audio, video {
  margin: 0;
  padding: 0;
  border: 0;
  outline: 0;
  font-size: 100%;
  vertical-align: baseline;
  background: transparent;
}
body {
  line-height: 1;
}
article,aside,details,figcaption,figure,footer,header,hgroup,nav,section {
  display: block;
}
a {
  margin: 0;
  padding: 0;
  font-size: 100%;
  vertical-align: baseline;
  background: transparent;
}
table {
  border-collapse: collapse;
  border-spacing: 0;
}
/* change border colour to suit your needs */
hr {
  display: block;
  height: 1px;
  border: 0;
  border-top: 1px solid #cccccc;
  margin: 1em 0;
  padding: 0;
}
input, select {
  vertical-align: middle;
}
ins {
  text-decoration: none;
}
del {
  text-decoration: line-through;
}
mark {
  font-style: italic;
  font-weight: bold;
}

There's too much in here, need to scale it down to pieces1.

nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

HTML5 reset1.

I added margin and padding rule, because we are abusing list as navigational links, the context and behavior which we expected from list is different from how list normally works.

article, aside, dialog, figure, footer, header, hgroup, nav, section {
  display: block;
  zoom: 1;
}
Add zoom: 1 for IE6 might make it easier5.
blockquote {
  quotes: '"' '"' "'" "'";
}
blockquote::before {
  content: open-quote;
}
blockquote::after {
  content: close-quote;
}

Blockquote doesn’t have quotes by default3.

HTML5 reset set this to none 1, and footnote 3 said it already is.

Use margin to change indentation. See blockquote html element.

fieldset:disabled,
input:disabled,
button:disabled,
select:disabled,
optgroup:disabled,
option:disabled,
textarea:disabled,
keygen:disabled,
command:disabled {
  cursor: not-allowed;
}
Make disabled controls more obviously disabled.
ins, mark {
  background-color: white;
  color: black;
}

HTML5 reset1.

A background color should never be set without a text color2.

abbr[title], dfn[title] {
  border-bottom:1px dotted;
}
Don't specify border-color and just use the text-color4.
Don't use cursor: help3.
a, a:focus {
  outline: 0
}

Big accessibility issue because keyboard users can't see the focused element2.

q {
  quotes: none;
}
q::before, q::after {
  content: '';
  content: none;
}

Feed reader and non-CSS browsers such as Lynx will add quotation characters by default3.

I don't know what list this is.

Footnotes.

  1. An article about HTML5 reset stylesheet in html5doctor, and a link to HTML5 reset stylesheet project page at code.google.
  2. From Martin Kliehm's comment in html5doctor.
  3. From zcorpan's comment in html5doctor.
  4. From Florent V's comment in html5doctor, also on this comment about web browser's default stylesheet.
  5. From Paul Irish's comment in html5doctor.

Labels: