Fredrik Fredrik - 1 year ago 67
CSS Question

Why does the list style disappear when display: block is added to a list item in a list (<ul> or <ol>)?

This seems to valid for

display: inline;
display: inline-block;

This is what I mean:

ul li {
display: block;
/* Or display: inline; */
/* Or display: inline-block; */

<li>list item1</li>
<li>list item3</li>
<li>list item3</li>

And with list style I mean the actual "bullets" or "numbers" (when
is used)

Answer Source

That's because normally, display is set to list-item for <li> elements. See the W3C CSS3 specification:

To declare a list item, the ‘display’ property should be set to ‘list-item’.

Note that you can give arbitrary HTML elements the same behaviour; set display: list-item on a <div> for example.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download