Why TD width is not working or not followed?

后端 未结 4 1461
無奈伤痛
無奈伤痛 2020-12-08 11:53

Original question: Does HTML

have a default width?

Recently someone asked a question somewhere along these lines, and got

4条回答
  •  孤城傲影
    2020-12-08 12:34

    I highly believe the answer to this question is such:

    The priority of widths that will affect the TD is

    1. Table Width

    2. Parent Element Width (and if none, Viewport)

    3. Element(TD) Width.

    Hence if the table width is set, the TD's will ALWAYS adjust to the width of the table. However, if the width is unset, the "main" width will be the true width of the viewport. Unless the CSS code states otherwise, this holds true. And only when the total width of the TD's is smaller than that of the viewport, the elemental width will be taken into account.

    Edit

    1. Table width will always override TD width.

    2. Stated TD width will only be followed until it exceeds viewport width, and viewport width will be taken as priority.

提交回复
热议问题