Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

Height property with html tables

  • 2 balasan
  • 4 ada masalah ini
  • 1 paparan
  • Balasan terakhir oleh Luzaritz

more options

Using nested tables to solve problems of horizontal alignments , I used the height=100% property for a table inside a td. The inner table doesn't fit the outer td's height, but simply adapts to the height of its contents, and is centered into the outer td. Using valign="top" for the outer td does align the inner table to the top, but this is just a bypass. This is not what I expected, since according to W3Schools, using % "Sets the height in percent of the surrounding element (example: height="50%")" (http://www.w3schools.com/tags/att_td_height.asp). I am using Firefox 36 with Windows 7.

Thank you for clarifying this point (I could see that Chrome behaves the same way).

Best regards

Luzaritz

Using nested tables to solve problems of horizontal alignments , I used the height=100% property for a table inside a td. The inner table doesn't fit the outer td's height, but simply adapts to the height of its contents, and is centered into the outer td. Using valign="top" for the outer td does align the inner table to the top, but this is just a bypass. This is not what I expected, since according to W3Schools, using % "Sets the height in percent of the surrounding element (example: height="50%")" (http://www.w3schools.com/tags/att_td_height.asp). I am using Firefox 36 with Windows 7. Thank you for clarifying this point (I could see that Chrome behaves the same way). Best regards Luzaritz

All Replies (2)

more options

Setting the height of the surrounding element refers to the surrounding html tag, the element is within a table so this can be confusing. When you say horizontal, I will assume you mean vertical as you are talking about the height of the table.

Table elements take on the style of the table over the css style sheet. However since Chrome behaves the same way I do not understand the question.

more options

When I define 100% for a table height (table height="100%"), and this table is an INNER table defined within a CELL (this cell is of course defined with a "td", inside a "tr", inside a "tbody/table" for the OUTER table), I expect the height of the INNER table will take on the height of the CELL within wich it is defined (the surrounding element is the cell). But this is not what happens. The height of the INNER table is just dependent on its OWN contents. I use this to try to get HORIZONTAL alignment across INNER tables defined into each cell of one row, defining ONE inner table into each cell (Then to obtain left VERTICAL alignment for items inside each INNER table, defining one row, then several cells, into each of these inner tables). This may seem a little tricky, but this is HOW I NEED it works. But it doesn't. And this is why I use the "valign=top" property for the surrounding cells, in order to align HORIZONTALLY the inner tables (each defined within each cell) of one same row. Now, just checking that Chrome behaves the same way doesn't mean there is no problem, but only that Chrome has the same problem. I hope this will help understand what I think is a problem of compliance with the "height=100%" property.

Best regards