inherit
134792
0
Aug 4, 2015 5:12:03 GMT -8
slime
109
December 2008
slime
|
Post by slime on Nov 3, 2012 6:39:01 GMT -8
Hi I am converting table cells from absolute (px) to relative (%) .. i am familiar with doing this with cell width..
Does relative sizing also work with cell height, and what is the difference if there is any? thanks!
|
|
inherit
134792
0
Aug 4, 2015 5:12:03 GMT -8
slime
109
December 2008
slime
|
Post by slime on Nov 4, 2012 1:07:31 GMT -8
any help?
|
|
inherit
130228
0
Jul 11, 2024 19:19:59 GMT -8
Charles Stover
1,731
August 2008
gamechief
|
Post by Charles Stover on Nov 16, 2012 20:18:50 GMT -8
Relative heights are something that should generally be avoided altogether in HTML4 (I don't know if they were fixed in HTML5).
As far as I know, they only work if the table itself has a set height. HTML documents don't innately have a height (or, that is to say, items in a document automatically have a 100% height). When most people think about document heights, they think similarly to document widths -- the window's dimensions. Given a <body> tag, the width is the same as the browser window's width. However, given a <body> tag, the height is not the same as the browser window's height. It's only as high as the content that's been created thus far.
So when you add a table to the end of your document, the height of that table is exactly what shows. It's 100% height from the beginning of that table to the bottom of that table. The height of that table is determined by its contents. If you shrink the contents, the table height shrinks. If you set the cell height to 50%, the table's height would have to shrink too, to be the same size as the new contents (the cell). So, you can't shrink cells like that.
If the table had a fixed height, say, 1000px, you could - as far as I know - set the cell height to 50%, which would thus mean 500px. But if the table's height is 100%, there is no % for the cell to be relative to the 100% table height, since a 100% height in HTML is simply the default height of the element.
|
|