Best way to manage whitespace between inline list items

后端 未结 8 1151
悲哀的现实
悲哀的现实 2020-11-28 06:48

My HTML is as follows:

8条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-28 07:15

    What you really want is the CSS3 white-space-collapse: discard. But I'm not sure if any browsers actually support that property.

    A couple alternative solutions is to let the tailing end of a tag consume the whitespace. For example:

    
    

    Another thing I've seen done is to use HTML comments to consume whitespace

    
    

    See thismat's solution if you are okay using floats, and depending on the requirements you might need to add a trailing

  • that is set to clear: both;.

    But the CSS3 property is probably the best theoretical way.

提交回复
热议问题