HTML Table, first and last column fixed width and columns between dynamic, but equal width

前端 未结 7 1359
长发绾君心
长发绾君心 2021-01-04 09:35

Is it possible to have a table with width 100% (so the table fits the screen size), where the first and the last column have a fixed width, and the columns between take the

7条回答
  •  一生所求
    2021-01-04 09:55

    In my opinion, the simple, nice and easy way is that don't use the px and % together. If you are using table width 100%, then define width of first and last column in % as well. If you are interested in that, here is how you can do:

    CSS:

    .mytable {
        width:100%;
        border: 1px solid green;
    }
    
    .left{
        width:30%;
        border-right:1px dashed blue;
    }
    
    .mid1{
       width:30%;
       border-right:1px dashed blue;
    
    }
    
    .mid2{
      width:30%;
       border-right:1px dashed blue;
    
    }
    
    .right{
        width: 10%;
        border-left:1px dashed blue;
    }
    

    HTML:

    Left Column, 30% Mid 1, 30% Mid 2, 30% Right, 10%

提交回复
热议问题