Simple two column html layout without using tables

后端 未结 12 1722
夕颜
夕颜 2021-01-30 05:17

I\'m looking for a super easy method to create a two column format to display some data on a webpage. How can i achieve the same format as:


    &l         
12条回答
  •  逝去的感伤
    2021-01-30 05:43

    All the previous answers only provide a hard-coded location of where the first column ends and the second column starts. I would have expected that this is not required or even not wanted.

    Recent CSS versions know about an attribute called columns which makes column based layouts super easy. For older browsers you need to include -moz-columns and -webkit-columns, too.

    Here's a very simple example which creates up to three columns if each of them has at least 200 pixes width, otherwise less columns are used:

    
      
        CSS based columns
      
      
        

    CSS based columns

    • Item one
    • Item two
    • Item three
    • Item four
    • Item five
    • Item six
    • Item eight
    • Item nine
    • Item ten
    • Item eleven
    • Item twelve
    • Item thirteen

提交回复
热议问题