Computed column width is different than css declared width for column. How does browser decide width?

后端 未结 4 563
暖寄归人
暖寄归人 2021-01-17 11:29

Let\'s say I have an html table with a css declared width of 750px. It has 5 columns and each column has a width of 50px, declared using css (all td\'s have a 50px width). O

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-17 12:06

    Browsers attempt to fit the cells within the table width, expanding/contracting the tds as needed.

    So, you set the table at 750px, but only gave 250px of width. In that case, the browser will resort to its traditional spacing scheme where, based on the content in each cell, attempts to evenly space out the cells.

    You can read more about how this works here.

提交回复
热议问题