On Sat, Jul 26, 2025 at 02:21:31AM +0100, Gavin Smith wrote:
> I've made a few changes and am quite happy with the HTML index formatting
> now.   I've used "font-size: larger" for the letter headers.  I have
> not tried to indent the index entries under the headers as I didn't think
> it was really necessary.

I tried to indent the index entries with CSS, but there is a conflict
between the rules for index entries and the rules for subentries.

I was outputting rules like this:

  td.index-entry-level-1 { padding-left: 3.5 em }
  td.printindex-index-entry { vertical-align: top; padding-left: 2em }

Since index subentries are output with both the "printindex-index-entry"
and "index-entry-level-1" (or "index-entry-level-2") classes, i.e. they
look like the following:

  <tr><td class="printindex-index-entry index-entry-level-1">

- the "padding-left" setting for td.index-entry-level-1 is actually ignored.
It's not possible to effectively specify different "padding-left" settings
for the subentries, as the rule for "td.printindex-index-entry" takes
priority (this is due to the CSS rules being output in alphabetical
order in the HTML file, which is something that we shouldn't rely on).

A simple solution would be to avoid outputting the "printindex-index-entry"
class for index subentries and to put all the needed rules on both
classes.

I read that you could have more "specificity" for a CSS rule by having
more classes, so an alternative is to output rules like this:

  td.index-entry-level-1 { padding-left: 3.5 em }
  td.index-entry-level-1.printindex-index-entry { vertical-align: top; 
padding-left: 2em }

- however, we don't output any other multiple-class rules currently.

Reply via email to