byronyasgur
byronyasgur

Reputation: 4747

apply list-style-type to ul or li

I cant seem to find a conclusive answer on whether i should be applying the style list-style-type ( or any of it's relatives ) to ul/ol tags or to the li tag. This is probably because it doesn't make any difference but maybe someone could confirm that and offer a suggestion as to best practice.

Upvotes: 14

Views: 5352

Answers (2)

Einacio
Einacio

Reputation: 3532

the best practice is to assign list styles to the list itself (ul, ol), and li's will have it because of the cascading

from w3 css2.1 recommendation:

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.

however, ie6 and 7 won't recognize this inheritance correctly, so you'll have to apply the list styles to li elements if you plan to support them

Upvotes: 20

entropid
entropid

Reputation: 6239

As you can see from the W3C documentation, it applies to elements with display: list-item, that means to ul and ol elements.

Upvotes: 3

Related Questions