Trang web này sẽ có chức năng hạn chế trong khi chúng tôi trải qua bảo trì để cải thiện trải nghiệm của bạn. Nếu một bài viết không giải quyết được vấn đề của bạn và bạn muốn đặt câu hỏi, chúng tôi có cộng đồng hỗ trợ của chúng tôi đang chờ để giúp bạn tại @FirefoxSupport trên Twitter và /r/firefox trên Reddit.

Tìm kiếm hỗ trợ

Tránh các lừa đảo về hỗ trợ. Chúng tôi sẽ không bao giờ yêu cầu bạn gọi hoặc nhắn tin đến số điện thoại hoặc chia sẻ thông tin cá nhân. Vui lòng báo cáo hoạt động đáng ngờ bằng cách sử dụng tùy chọn "Báo cáo lạm dụng".

Tìm hiểu thêm

Height property with html tables

  • 2 trả lời
  • 4 gặp vấn đề này
  • 1 lượt xem
  • Trả lời mới nhất được viết bởi 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

Tất cả các câu trả lời (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