Horizontal (inline) list in HTML/CSS with divs

后端 未结 4 1715
醉话见心
醉话见心 2021-01-06 09:11

I am trying to build a simple horizontal list, where each list item is a div and I want them all to sit next to one another. When I try to use the code below though, the div

4条回答
  •  不思量自难忘°
    2021-01-06 09:53

    Each div inside the list items is displayed as a block by default. Display them inline as well and it should work.

    #navlist div, #navlist li
    {
      display: inline;
    }
    #navlist li
    {
      list-style-type: none;
      padding-right: 20px;
    }
    

提交回复
热议问题