CSS to line break before/after a particular `inline-block` item

后端 未结 9 1626
再見小時候
再見小時候 2020-11-27 09:36

Let\'s say I have this HTML:

Features

  • Smells Good
  • <
9条回答
  •  不知归路
    2020-11-27 10:25

    I know you didn't want to use floats and the question was just theory but in case anyone finds this useful, here's a solution using floats.

    Add a class of left to your li elements that you want to float:

  • Smells Good
  • and amend your CSS as follows:

    li { text-align:center; float: left; clear: left; padding:0.1em 1em }
    .left {float: left; clear: none;}
    

    http://jsfiddle.net/chut319/xJ3pe/

    You don't need to specify widths or inline-blocks and works as far back as IE6.

提交回复
热议问题