Showing posts with label html. Show all posts
Showing posts with label html. Show all posts

Saturday, March 21, 2009

Auto Numbering Headers in Google Docs

Google Docs allows generation of table of contents, but doesn't by default number the headers. This inability can be overcome via some CSS magic.

Simply put these into the CSS file, opened from Edit menu's Edit CSS item. This will autonumber header 2,3 and 4. (H2, H3, H4)


body {
counter-reset: chapter;
}

h2 {
counter-reset: section;
counter-increment: chapter;
}
h3 {
counter-increment: section;
counter-reset: part;
}
h4 {
font-weight: bold;
counter-increment: part;
}
H2:before {
content: counter(chapter) "." " ";
}
H3:before {
content: counter(chapter) "." counter(section) " ";
}
H4:before {
content: counter(chapter) "." counter(section) "." counter(part) " ";
}