Replace HTML Table with Divs

前端 未结 6 1452
刺人心
刺人心 2020-12-07 15:29

Alright, I\'m trying to buy into the idea that html tables should not be used, and that divs should be. However, I often have code that resembles the following



        
6条回答
  •  萌比男神i
    2020-12-07 16:20

    I looked all over for an easy solution and found this code that worked for me. The right div is a third column which I left in for readability sake.

    Here is the HTML:

    PHONE & FAX:

    +43 99 554 28 53

    Cellphone Gert:

    +43 99 302 52 32

    Cellphone Petra:

    +43 99 739 38 84

    And the CSS:

    .container {
        display: table;
        }
    .row  {
        display: table-row;
        }
    .left, .right, .middle {
        display: table-cell;
        padding-right: 25px;
        }
    .left p, .right p, .middle p {
        margin: 1px 1px;
       }
    

提交回复
热议问题