How to use divs instead of tables

前端 未结 5 1309
被撕碎了的回忆
被撕碎了的回忆 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:47

    rowspan is not avalaible for display:table,
    but you can still use it to get close to what you are looking for.
    http://codepen.io/anon/pen/kqDab
    display:inline-table used for the show , so they stand aside each others. you can turn it back to display:table.

    Options i see here is to set an height to parent container to have height:XX% avalaible for direct childs element (if it is: float, inline-block, table ...) . Other option is vertical-align middle for the cell if display:table-cell;.

    You HTML with the same CSS of first demo : http://codepen.io/anon/pen/dvlsG


    edit display:flex is also a good option nowdays :http://codepen.io/anon/pen/aBjqXJ

提交回复
热议问题