Horizontal (inline) list in HTML/CSS with divs

后端 未结 4 1739
醉话见心
醉话见心 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 10:01

    #navlist li { display:inline }
    #navlist div { display:inline }
    

    Making the

  • inline while leaving the
    as block is your problem.

    Alternatively, you may want inline-block for the

  • if you are going to be controlling sizes or margins.

    You may also be interested in this demo: http://phrogz.net/JS/ul2menu/purecss_testsuite.html

    I'm not sure why you have

    inside your
  • , but I presume you have your reasons.

提交回复
热议问题