How to use divs instead of tables

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

    You need inline-block and float: here's the jsFiddle

    .list-row {
        background:#f4f4f4;
        display:inline-block;
        border:2px solid red;}
    
    .list-left {
        width:auto;
        padding:10px;
        float:left;
        border: 2px solid blue;}
    
    .list-right {
        padding:10px;
        float:right;
        border:2px solid green;}
    

    Also, since you're not using relative or absolute positioning, you don't need to specify top and left.

提交回复
热议问题