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

后端 未结 4 567
暖寄归人
暖寄归人 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:11

    You need to use the table-layout style. There's 3 possible values:

    • auto. The default. Width is dependent on content.
    • fixed. Depends on the stated widths in the CSS.
    • inherit. Inherits the value from it's parent.

    In your case you need to use table-layout: fixed on your table element.

提交回复
热议问题