Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Multi-level numbered lists without trailing dot on sub-levels?

0 views
Skip to first unread message

Robert Prins

unread,
Jan 16, 2021, 1:35:14 PM1/16/21
to
ol.ml {
list-style-type:none;
counter-reset:list;
}
ol.ml li:before {
counter-increment:list;
content: counters(list, ".") ". ";
}

By using the above, I can create lists with

1.
1.1.
1.2.
1.2.1.
2.
2.1.
2.1.1.
2.1.2.

etc numbering, which is what I (almost) need. However, is there a way of
removing the final '.' on the *lower* levels, so that the above would come out as

1.
1.1
1.2
1.2.1
2.
2.1
2.1.1
2.1.2

which is waht I really "need"?

Thanks,

Robert
--
Robert AH Prins
robert(a)prino(d)org
The hitchhiking grandfather - https://prino.neocities.org/indez.html
Some REXX code for use on z/OS - https://prino.neocities.org/zOS/zOS-Tools.html

Stan Brown

unread,
Jan 16, 2021, 1:52:13 PM1/16/21
to
On Sat, 16 Jan 2021 20:34:09 +0000, Robert Prins wrote:
>
> ol.ml li:before {
> counter-increment:list;
> content: counters(list, ".") ". ";
> }
>
> By using the above, I can create lists with
> 1.
> 1.1.
> 1.2.
> etc numbering, which is what I (almost) need. However, is there a
> way of removing the final '.' on the *lower* levels, so that the
> above would come out as
> 1.
> 1.1
> 1.2
> which is waht I really "need"?

The selector to access a lower-level list is ol.ml ol.ml li { ... }.

This specifies <ol class="ml>, within it another <ol class="ml">, and
within that an <li>.

Think of the space between tags and classes as meaning "containing".
Since it is more specfic, it will override any conflicting properties
in your "om.ml li:before" selector.

--
Stan Brown, Tehachapi, California, USA
https://BrownMath.com/
https://OakRoadSystems.com/
0 new messages