New Perspectives On Web Design

(C. Jardin) #1
By Marko Dugonjić CHAPTER 9

Vladimir Simović goes a little further and explains how to apply automatic
numbering to headings^75 which is very useful for eBook publishing.


body { counter-reset: subhead1; }


h1:before {
content: counter(subhead1) " ";
counter-increment: subhead1;
}
h1 {
counter-reset: subhead2;
}
h2:before {
content: counter(subhead1) "." counter(subhead2) " ";
counter-increment: subhead2;
}
h2 {
counter-reset: subhead3;
}


h3:before {
content: counter(subhead1) "." counter(subhead2) "."
counter(subhead3) " ";
counter-increment: subhead3;
}


hieRaRChY


You never would have guessed! Typography can help with inaugurating
a document structure, too. Subheads provide the reader with a clue about
the content that follows; side- and footnotes provide us with additional
explanations of the key terms inside the text; and captions provide descrip-
tions for figures, data tables and graphs. All these elements form part of the
typographic hierarchy.


75 http://smashed.by/css-headings

Free download pdf