tags:

views:

93

answers:

3

Should the list styling properties go on the ul element or the li elements?

I have never seen lists with different little icons to the left of them (within the same ul), but I have seen the property used on both elements before in my travels.

Which one is correct?

A: 

According to this,

The list-style property is a shorthand property for setting all the properties for a list in one declaration.

ul
{
    list-style: disc outside
}
Kirtan
+2  A: 

It should go on the ul/ol, cf. http://www.w3.org/TR/CSS2/generate.html#list-style

Edit: Near the bottom ( http://www.w3.org/TR/CSS2/generate.html#propdef-list-style ) you will find a discussion of the issue. It boils down to:

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.

jensgram
A: 

I suggest to put it on the ul/ol. If you'd put it on the li, it would apply to both ordered and unordered lists, which is probably not what you want (the numbering would disappear).

Ms2ger
Well, that depends on how you express the qualifier (e.g. `.something li` vs. `.something ul li`)
jensgram
That wouldn't work for an ol inside a ul.
Ms2ger
You're quite right. Sorry :) `.something ul > li` then.
jensgram