Should the CSS property list-style be applied to / or ?

According to the W3C CSS2 reference, which can be found here,

Another solution would be to specify ‘list-style’ information only on the list type elements:

ol.alpha  { list-style-type: lower-alpha }
ul        { list-style-type: disc }

Inheritance will transfer the ‘list-style’ values from OL and UL elements to LI elements. This is the recommended way to specify list style information.

So you can do it at the overall list level if all of your elements are going to be the same, but you can instead do it at the list entry level if for example some entries would have different glyphs (like a square instead of a disc) to convey some meaning. You can also do both, with the list level style serving as a default to be overridden (but be careful about selector precedence!).

Leave a Comment

tech