Thread: TOC h2: h3
View Single Post
Old 09-29-2024, 11:22 PM   #14
hobnail
Running with scissors
hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.
 
Posts: 1,590
Karma: 14328510
Join Date: Nov 2019
Device: none
Quote:
Originally Posted by theducks View Post
<h2 class-"whatever" title="the real words for the TOC">

A little REGEXfoo and you can build the title= bit

I think this is similar to what I had used. But it's been years and I've forgotten. There's a chapter numbering plugin for Sigil that I used to generate the "Chapter One" etc. with h1 tags, and then below that I think I had an h2 tag with the descriptive name. Then I used a regex to convert that to something like
Code:
<h2>Chapter One <span>Descriptive Title</span></h2>
In my CSS file I had
Code:
h2 span, h3 span {
    display: block;
    font-size: larger;
    font-style: italic;
    font-variant: normal;
    font-weight: bold;
    margin-top: 1.25em
     }
The "trick" is that display:block; the above CSS applies to the span inside the h2, not the h2. The display:block puts on a separate line what's inside the span.

If you look for the book Batwing Bowles by Dane Coolidge here in the mobileread library you can see the final result. Both the TOC and the chapter first pages.

Last edited by hobnail; 09-29-2024 at 11:25 PM.
hobnail is offline   Reply With Quote