In the firstplace I did the numbering of the google-docs headlines with css. But the numbering in the google-docs always got messed up after some time, which was caused by:
a) The behaviour of google-docs: It sometimes wraps the headlines in an extra div (which i consider as a bug)
b) Browser limitations of css numbering, if the numbered elements are not all on the same dom level (because of the extra google-docs div)
I wrote up some test-cases with diffeerent order of h1/h2/div elements.
As you can see (at least in firefox 3 and google chrome), the numbering does not count up for sub-headlines
(Note: For my post here in wordpress i changed <h1> to <div class="head1">)
all counters on one level
all counters wrapped in a separate div
sub-counters wrapped in a sub-div
only h2-counters wrappwed
If the numbering gets messed up i start firebug and remove the surrounding div of the wrong headline. Maybe i will create a bookmarklet for this task when i get too annoyed at working with google-docs again :)
And here’s my last stylesheet, which i add to all my google-docs.
You can preview a published document here
* { line-height: 160%; font-size: 10pt; } /** HEADLINES **/ h1 { font-size: 20pt; counter-increment: counter-h1; counter-reset: counter-h2; } h2 { font-size: 17pt; counter-increment: counter-h2; counter-reset: counter-h3; } h3 { font-size: 14pt; counter-increment: counter-h3; counter-reset: counter-h4; } h4 { font-size: 11pt; font-weight: bold; counter-increment: counter-h4; counter-reset: counter-h5; } h5 { font-size: 11pt; font-weight: bold; counter-increment: counter-h5; counter-reset: counter-h6; } h6 { font-size: 11pt; font-weight: bold; counter-increment: counter-h6; } h1:before { content: counter(counter-h1) ". "; color: #777; } h2:before { content: counter(counter-h1) "." counter(counter-h2) ". "; color: #777; } h3:before { content: counter(counter-h1) "." counter(counter-h2) "." counter(counter-h3) ". "; color: #777; } h4:before { content: counter(counter-h1) "." counter(counter-h2) "." counter(counter-h3) "." counter(counter-h4) ". "; color: #777; } h5:before { content: counter(counter-h1) "." counter(counter-h2) "." counter(counter-h3) "." counter(counter-h4) "." counter(counter-h5) ". "; color: #777; } h6:before { content: counter(counter-h1) "." counter(counter-h2) "." counter(counter-h3) "." counter(counter-h4) "." counter(counter-h5) "." counter(counter-h6) ". "; color: #777; } /** TEXT **/ p { padding: 5pt 0 10pt 0; text-align: justify; } li { text-align: justify; padding-bottom: 5pt; } li p { padding: 5pt 0; } li p:first-child { padding-top: 0; } li p:last-child { padding-bottom: 0; }
Tags: css, Google Docs
November 18th, 2009 at 03:01
This CSS and the auto numbering JavaScript code are excellent solutions to missing Google Docs functionality. Which do you prefer to use for your documents, and do you use the CSS in conjunction with GDoc’s TOC feature?
November 29th, 2009 at 17:11
thanks sutch,
since this blog-post i exclusively started using the css numbering solution. it does work like a charm in all my recent team-written-documents.
but i haven’t had time to test the css rules with the google toc features, but if i have some additions to the css, i will post them here. :)
February 3rd, 2010 at 21:57
Is there any way to make the headings in google docs non-bold?
I have changed my css to include font-style:normal but that doesn’t work. Any ideas?
Thanks
February 4th, 2010 at 00:21
hi laurie,
the correct css style would be
font-weight: normal;
February 27th, 2010 at 13:06
Thanks for the CSS works really well.
June 16th, 2010 at 14:41
This editorialwas a brilliant read. I Learnt alot from it. Thanks for sharing.
June 16th, 2010 at 16:25
Hello everyone thanks for
good information.