Open fantasai opened 1 year ago
counters()
is even more problematic tbh; you simply can't use it if the distinct levels use different counter styles, since it maps all the counter values into the specified style.
So I agree that lettings counters have an associated style which is used by default would be pretty nice.
Thank you @fantasai for bringing up target-counter
. This case has always bugged me - my chapters are styled in upper-roman
, but if I use target-counter(attr(href url), chapter)
I get decimal, and I've no way of saying "give me the style used by the target". So I thoroughly support this.
One worry I have with counter-style
is the additive CSS issue - presuming a syntax like counter-style: chapter upper-roman
, I can set the style for a particular counter but only by resetting all other styles. I know it's not a new issue or specific to this property, and I appreciate it's a tricky one.
@faceless2 I was intending that you only affect the counters reset in counter-reset
on the same element.
The CSS Working Group just discussed [css-lists-4][css-content-3] Add counter-style property to associate default counter style
, and agreed to the following:
RESOLVED: add counter-style that associates default counter styles with each counter specified by counter-reset on the same element
RESOLVED: counter-style property takes a list of counter style keywords, which are matched up to counter-reset using coordinated list logic
RESOLVED: name tbd
RESOLVED: Work on counter shorthand
RESOLVED: All the counter things
Currently counters are associated with a name, but they're not associated with a counter style. You have to provide that style manually every time you use the
counters()
function. This is kindof okay for most uses of counters, but it's a bit of a problem fortarget-counter()
because then you have to track which counters use which styles, and it gets extra complicated if you want to do multi-level lists (which all have the same counter name).I think it would be good to introduce a
counter-style
property that tracks withcounter-reset
, and associates the named counter with its default style. Authors can still override it, but then at least it can default to the same representation everywhere it occurs.