HTML Table width in percentage, table rows separated equally

前端 未结 5 1279
野的像风
野的像风 2020-12-28 14:38

When I create a table in html, a table with a width of 100%, if I want all the cells (tds) to be divided in equal parts, do I have to enter the width % for each cell? Am I \

5条回答
  •  北荒
    北荒 (楼主)
    2020-12-28 14:48

    Yes, you will need to specify the width for each cell, otherwise they will try to be "intelligent" about it and divide the 100% between whichever cells think they need it most. Cells with more content will take up more width than those with less.

    To make sure you get equal width for each cell you need to make it clear. Either do it as you already have, or use CSS.

    table.className td { width: 25%; }
    

提交回复
热议问题