How to use divs instead of tables

前端 未结 5 1303
被撕碎了的回忆
被撕碎了的回忆 2021-02-04 04:25

I am trying to create the following table layout, but I want to use DIV instead of TABLE:

------------------
|       |        |
| CELL1 |  CELL2 |
|       |              


        
5条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-04 04:43

    Try the following: (working jsFiddle)

    HTML:

    CSS:

    .container{overflow:hidden; width:100%;}
    .cell{width:50%; float:right;}
    #cell1{float:left;}
    

    Your approach (which places the divs in rows) is not a good choice in this case.. mine separates them by columns.

提交回复
热议问题