How to style the UL list to a single line

前端 未结 5 959
时光取名叫无心
时光取名叫无心 2020-12-02 08:40

I want to render this list in a single line.

  • List item1
  • List item2

Should be shown as

*List item2 *List item2

What CSS

5条回答
  •  再見小時候
    2020-12-02 09:41

    Try experimenting with something like this also:

    HTML

     
    • She
    • Needs
    • More Padding, Captain!

    CSS

     .inlineList {
       display: flex;
       flex-direction: row;
       /* Below sets up your display method: flex-start|flex-end|space-between|space-around */
       justify-content: flex-start; 
       /* Below removes bullets and cleans white-space */
       list-style: none;
       padding: 0;
       /* Bonus: forces no word-wrap */
       white-space: nowrap;
     }
     /* Here, I got you started.
     li {
       padding-top: 50px;
       padding-bottom: 50px;
       padding-left: 50px;
       padding-right: 50px;
     }
     */
    

    I made a codepen to illustrate: http://codepen.io/agm1984/pen/mOxaEM

提交回复
热议问题