07-05-2013, 09:51 PM | #16 |
Wizard
Posts: 1,071
Karma: 412718
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
|
My little project is really coming togeather; your explainations have really helped a lot
So I tried emulate a numbering style that I've seen many times: H1's = Section x H2's = Chapter x Except that the H2 counter doesn't get reset to 1 when the H1 changes, and the H1's continue to Increment: Section 1 Chapter 1 Chapter 2 Chapter 3 Section 2 Chapter 4 Chapter 5 Chapter 6 It looks so easy. I have the H2's continuing to increment, but the H1 counter remains 'stuck' at 1. Can anyone see what I'm doing wrong, or not doing right? Code:
body { counter-reset:h1number; counter-reset:h2number; } h1:before { counter-increment:h1number; content:"Section# " counter(h1number) " – "; } h2:before { counter-increment:h2number; content:"Chapter# " counter(h2number) " – "; } Thanks Paul |
07-05-2013, 11:01 PM | #17 |
Grand Sorcerer
Posts: 12,167
Karma: 73448616
Join Date: Nov 2007
Location: Toronto
Device: Nexus 7, Clara, Touch, Tolino EPOS
|
Try this
Code:
body { counter-reset: h1number; } h1:before { content: "Section # " counter(h1number) " - "; counter-increment: h1number; } h1 { counter-reset: h2number; } h2:before { content: "Chapter# " counter(h2number) " - "; counter-increment: h2number; } |
07-06-2013, 11:02 AM | #18 |
Wizard
Posts: 1,071
Karma: 412718
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
|
Thanks, but that's pretty much where I started, before I tried to be clever
Look at the screen shot which has your CSS. The H1's increment, but the H2's reset to 1 when the H1 changes. I was trying to get the two counters to run 'independently' without the H2 counter reseting to 1 in the h1 { } so that the H1 counter just count up, and the h2 counters also just count up So I was trying to get an automated numbering like I saw in some books, and I decided to try getting the counter's to give me: Section 1 Chapter 1 Chapter 2 Chapter 3 Section 2 <------ should be incremented, but remains = 1 in my CSS Chapter 4 <----- not reset to 1, but just incremented Chapter 5 Chapter 6 Section 3 <------ should be incremented, but remains = 1 in my CSS Chapter 7 <----- not reset Chapter 8 Chapter 9 If all else fails, I'll go back to the outline numbering that I know works Paul |
07-06-2013, 11:49 AM | #19 |
Grand Sorcerer
Posts: 12,167
Karma: 73448616
Join Date: Nov 2007
Location: Toronto
Device: Nexus 7, Clara, Touch, Tolino EPOS
|
All I can say is that when i tried it worked perfectly. Chapters incremented and reset and sections increased.
Sorry to have wasted your time. |
07-06-2013, 01:54 PM | #20 |
Grand Sorcerer
Posts: 12,167
Karma: 73448616
Join Date: Nov 2007
Location: Toronto
Device: Nexus 7, Clara, Touch, Tolino EPOS
|
One final idea... Try
Code:
body { counter-reset:h1number h2number; } |
07-06-2013, 04:42 PM | #21 | |
Wizard
Posts: 1,071
Karma: 412718
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
|
Quote:
In my test doc with your CSS, the H1's increment, but the H2's reset to 1 within each H1 I was trying to have both the H1's and H2's count up independently with out resetting so I'd end up with something like Section 1 Chapter 1 Chapter 2 Chapter 3 Section 2 Chapter 4 Chapter 5 Chapter 6 Section 3 Chapter 7 Chapter 8 Chapter 9 Paul |
|
07-06-2013, 05:03 PM | #22 |
Grand Sorcerer
Posts: 12,167
Karma: 73448616
Join Date: Nov 2007
Location: Toronto
Device: Nexus 7, Clara, Touch, Tolino EPOS
|
See attached
Section #1 - One Chapter #1 - One-One Chapter #2 - One-Two Section #2 - Two Chapter #3 - Two-One Section #3 - Three Chapter #4 - Three-One Chapter #5 - Three-Two Chapter #6 - Three-Three Section #4 - Four Chapter #7 - Four-One |
07-06-2013, 06:21 PM | #23 |
Wizard
Posts: 1,071
Karma: 412718
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
|
Works well
Thanks for your efforts Paul |
07-06-2013, 06:28 PM | #24 |
Grand Sorcerer
Posts: 12,167
Karma: 73448616
Join Date: Nov 2007
Location: Toronto
Device: Nexus 7, Clara, Touch, Tolino EPOS
|
All I changed was to put the two counter-reset's for body in a single CSS statement....
|
07-06-2013, 09:15 PM | #25 | |
Bookmaker & Cat Slave
Posts: 11,462
Karma: 158448243
Join Date: Apr 2010
Location: Phoenix, AZ
Device: K2, iPad, KFire, PPW, Voyage, NookColor. 2 Droid, Oasis, Boox Note2
|
Quote:
Hitch |
|
07-06-2013, 09:30 PM | #26 |
Grand Sorcerer
Posts: 12,167
Karma: 73448616
Join Date: Nov 2007
Location: Toronto
Device: Nexus 7, Clara, Touch, Tolino EPOS
|
Hitch; I agree totally with you on that! I will admit though all this does pique my interest in learning more about CSS!
|
07-07-2013, 09:58 AM | #27 | ||
Wizard
Posts: 1,071
Karma: 412718
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
|
@PeterT --
Quote:
@Hitch -- Quote:
So the technique works well on the single file epubs but not on the multi-file ones (where it would really make life easier) ... darn. That also explains the situation I was seeing with a larger multi-html file test also Still, there's going to be times when the technique is useful and will save me some grunt work Paul Last edited by phossler; 07-07-2013 at 10:13 AM. |
||
07-07-2013, 11:51 AM | #28 |
Well trained by Cats
Posts: 29,803
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Many a time I have wished for a numbering plugin that worked on consecutive-selected files that would Insert/replace or After a specified pattern.
The tool would also allow choice of numbering styles: 1)Arabic, II)Roman, Three)Text with an optional user supplied Prefix string: eg. Chapter, Part, Section I just don't trust Calculated on the fly Chapter heading. 1 glitch and the TOC or other reference goes horribly wrong. <ol>'s are already notoriously erratic |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
line-counter needed | schuster | Calibre | 4 | 05-15-2011 12:15 PM |
Classic over the counter | iandix | Barnes & Noble NOOK | 7 | 02-07-2010 05:48 AM |
No Page Counter | andavane | Bookeen | 2 | 10-25-2009 04:32 AM |