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

后端 未结 5 432
执笔经年
执笔经年 2020-12-05 13:45

This seems to valid for display: inline; and display: inline-block; too.

This is what I mean:

ul li {
  display: block;
  /         


        
5条回答
  •  醉话见心
    2020-12-05 14:15

    An updated solution is to make use of :before and content.

    See this JSfiddle for a working example. http://jsfiddle.net/t72h3/

    ul li {
      display: inline-block;
    }
    
    ul li:before {
      content: "• ";
    }
    
    
    • list item1
    • list item3
    • list item3

提交回复
热议问题