How to force a list to be vertical using html css

后端 未结 4 369
广开言路
广开言路 2020-12-24 12:57

I have a list i want to add to a

. Each listitem contains a
which in turn contain an image and a text string. The list must
4条回答
  •  天命终不由人
    2020-12-24 13:19

    Hope this is your structure:

       
    • text

    • text

    • text

    By default, it will be add one after another row:

    -----
    -----
    -----
    

    if you want to make it vertical, just add float left to li, give width and height, make sure that content will not break the width:

    |  |  |
    |  |  |
    
    li
    {
       display:block;
       float:left;
       width:300px; /* adjust */
       height:150px; /* adjust */
       padding: 5px; /*adjust*/
    }
    

提交回复
热议问题