Fredrik Fredrik - 6 months ago 43
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)


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.