开发者

apply list-style-type to ul or li

开发者 https://www.devze.com 2023-04-06 20:25 出处:网络
I cant see开发者_Python百科m 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 becaus

I cant see开发者_Python百科m 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.


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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消