Getting a table to fill 100% height in a td

前端 未结 5 1158
灰色年华
灰色年华 2021-01-13 05:42

I\'m trying to rewrite a site in proper HTML. The site I\'m trying to replace was a complete mess. I\'ve run into a problem where I can\'t get a

t
5条回答
  •  耶瑟儿~
    2021-01-13 05:56

    100% height in a table cell is always a pain. Technically speaking a TD has no height (because that depends on its contents). What you are asking the browser to do is make the child 100% of its parent, which is 100% of its child, which is 100% of its parent ... You can see how that might be a problem.

    You could try adding an explicit height to the TD and using table-layout:fixed on the table. At least that way the browser knows the height of the parent without needing the height of the child but that still may not work.

    You might need to rethink how you go about this.

提交回复
热议问题