How to make a
    display in a horizontal row

后端 未结 7 1510
-上瘾入骨i
-上瘾入骨i 2020-11-28 05:29

How can I make my list items appear horizontally in a row using CSS?

7条回答
  •  被撕碎了的回忆
    2020-11-28 06:24

    As others have mentioned, you can set the li to display:inline;, or float the li left or right. Additionally, you can also use display:flex; on the ul. In the snippet below I also added justify-content:space-around to give it more spacing.

    For more information on flexbox, checkout this complete guide.

    #div_top_hypers {
        background-color:#eeeeee;
        display:inline;      
    }
    #ul_top_hypers {
        display: flex;
        justify-content:space-around;
        list-style-type:none;
    }

提交回复
热议问题