úterý 16. prosince 2008

Google Docs numbered headings

If you want to use Google Docs for longer technical document it would be nice to have a possibility to number headings. There is no easy way how to turn heading numbering on.

The problem can be solved using custom CSS. In Google Docs document go to Menu -> Edit -> Edit CSS and CSS text editing window opens. Put this CSS code inside the window and the heading numbers shall appear. Hmmm ... in every web browser except MS Internet Explorer.

Code:
h1 {
counter-increment: h1cntr;
counter-reset: h2cntr;
}
h1:before {
content: counter(h1cntr) ". ";
}
h2 {
counter-increment: h2cntr;
counter-reset: h3cntr;
}
h2:before {
content: counter(h1cntr) "." counter(h2cntr) " ";
}
h3:before {
content: counter(h1cntr) "." counter(h2cntr) "." counter(h3cntr) " ";
}
h3 {
counter-increment: h3cntr;
}