Flow multi-column elements left-right before top-down

后端 未结 1 1298
遇见更好的自我
遇见更好的自我 2020-12-21 08:15

Is this possible?

So if we had a list:

  • Item 1
  • Item 2
  • Item 3
  • Item 4

Instead of

Item 1 Item 3

相关标签:
1条回答
  • 2020-12-21 08:45

    Like this?

    <style>
      ul {list-style: none;}
      li {float: left;}
      li:nth-child(2n+1) {clear: left;} /* 1st of every twos */
    </style>
    <ul>
      <li>item 1</li>
      <li>item 2</li>
      <li>item 3</li>
      <li>item 4</li>
    </ul>
    
    0 讨论(0)
提交回复
热议问题