HTML Table width in percentage, table rows separated equally

前端 未结 5 1278
野的像风
野的像风 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 15:01

    Use the property table-layout:fixed; on the table to get equally spaced cells. If a column has a width set, then no matter what the content is, it will be the specified width. Columns without a width set will divide whatever room is left over among themselves.

    gobble de gook mibs

    Just to throw it out there, you could also use , which doesn't require repetition of style per table data or giving the table an id to use in a style sheet. I think setting the widths on the first row is enough though.

提交回复
热议问题