Summary: | CSS attribute "height" (in body or table) isn't rendered correctly | ||
---|---|---|---|
Product: | [Applications] konqueror | Reporter: | Martin <martin.nowack> |
Component: | khtml renderer | Assignee: | Konqueror Developers <konq-bugs> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | kde |
Priority: | NOR | ||
Version: | 3.3.2 | ||
Target Milestone: | --- | ||
Platform: | unspecified | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
Martin
2004-12-19 23:10:40 UTC
Any concrete examples of what you consider wrong? W3C says that a table on a website will cover the whole browser window from top to bottom if the CSS attribute "height:100%;" is used in both <table> and <body> tag. The height of one element on an HTML site is always set relative to the element on a higher level. So if I set a hight of my <body> it should be possible to make my <table> cover any given space in the browser window. Like: <body style="height:100%;"> <table style="height:100%;"> .................. </table> </body> would mean that my table covers 100% of the window. This should, of course, also work for constructs like <body style="height:100%;"> <table style="height:300px;"> .................. </table> </body> or other height values. Unfortunately this does not work with Konqueror. It seems to ignore those "height" attributes. Even if I do set a table to use 100% of the window, it will only use the space actually needed and NOT reach from top to bottom. That doesn't work? In quirk or strict mode? and have you tried setting the height of the html element to 100%? height-attribute of table-tag is not w3c conform and was never!! in any w3c-standard. Width and Height of th- and td-tag is deprecated and shouldn't be used in "Transitional 4.01" Standard. Okay. In konqueror we treat transitional the same as quirk mode. I know you should not use height atributes any longer and you should have never used it in a tr-tag, but I did try it, and it works in iexpl, firefox and opera, but not konqueror. In konqueror it only works in the top row, just test the example below, or click here http://lvdp.student.utwente.nl/temp/tabletest.html and you will see what I mean. not a big problem but a bit strange. <table border='0' cellspacing='0' bgcolor='#000000'> <tr height='10'> <td width='40' bgcolor='#FF0000'> </td> </tr> <tr height='10'> <td width='40' bgcolor='#00FF00'> </td> </tr> <tr height='10'> <td width='40' bgcolor='#0000FF'> </td> </tr> </table> <html><head><title>test</title></head> <body style="height: 100%"><table style="border: solid black 1px; height: 100%"><tr><td>a</td></tr></table></body></html> I created this gorgeous section of html as a concrete example of what he means. It renders differently in Konqy and Firefox. I'd have to agree with FF on this one, though I do not profess to recall the W3C's stance on this. Just one more thing ... I modified the page to the following which demonstrates that it's body (and not table) that's acting in a way other-than-expected: <html><head><title>test</title></head> <body style="border: solid red 1px; height: 300px"><table style="border: solid black 1px; height: 100%"><tr><td>a</td></tr></table></body></html> Test in comment #6 looks fine here. The issue in comment #8 and #9 is that setting BODY height doesn't affect the height of HTML as it should in quirk mode. Setting "html {height: 100%}" is a quirk work around that would make work in strict mode as well. SVN commit 580037 by carewolf: Height of body should be based on canvas in quirks mode. BUG:95489 Also affects quirksmode.org/css/height/minheightbody.html M +8 -1 render_box.cpp --- branches/KDE/3.5/kdelibs/khtml/rendering/render_box.cpp #580036:580037 @@ -736,7 +736,7 @@ } if(!isInline() || isReplaced()) { - _xPos += xPos(), + _xPos += xPos(), _yPos += yPos(); } @@ -1105,6 +1105,7 @@ if (cb->isTableCell() && style()->htmlHacks()) { result = static_cast<RenderTableCell*>(cb)->cellPercentageHeight(); } + // Otherwise we only use our percentage height if our containing block had a specified // height. else if (cb->style()->height().isFixed()) @@ -1132,6 +1133,12 @@ p->borderTop() + p->borderBottom() + p->paddingTop() + p->paddingBottom()); } + else if (cb->isRoot() && style()->htmlHacks() && cb->style()->height().isVariable()) { + int visHeight = canvas()->viewportHeight(); + result = visHeight - (marginTop() + marginBottom() + + borderTop() + borderBottom() + + paddingTop() + paddingBottom()); + } else if (cb->isAnonymousBlock() || treatAsReplaced && style()->htmlHacks()) { // IE quirk. result = cb->calcPercentageHeight(cb->style()->height(), treatAsReplaced); |