Side-by-side list items as icons within a div (css)

前端 未结 7 1730
臣服心动
臣服心动 2020-12-30 00:48

I am looking for a way to create a

    of items that I can put within a
    and have them show up side-by-side and wrap to the next
    相关标签:
7条回答
  • 2020-12-30 01:47

    I would recommend that you use display: inline;. float is screwed up in IE. Here is an example of how I would approach it:

    <ul class="side-by-side">
      <li>item 1<li>
      <li>item 2<li>
      <li>item 3<li>
    </ul>
    

    and here's the css:

    .side-by-side {
      width: 100%;
      border: 1px solid black;
    
    }
    .side-by-side li {
      display: inline;
    }
    

    Also, if you use floats the ul will not wrap around the li's and will instead have a hight of 0 in this example:

    .side-by-side li {
      float: left;
    }
    
    0 讨论(0)
提交回复
热议问题