table %age height attribute doesn't work if you specify a DOCTYPE at the top of your document




Layout: Tables
15 years ago
15 years ago


(Reporter: Davyd, Unassigned)



Firefox Tracking Flags

(Not tracked)



(3 attachments)



15 years ago
User-Agent:       Mozilla/5.0 Galeon/1.2.6 (X11; Linux i686; U;) Gecko/20020830
Build Identifier: Mozilla/5.0 Galeon/1.2.6 (X11; Linux i686; U;) Gecko/20020830

Both the lines <table height="100%"> and <table class="foo"> where foo is a CSS
class containing:
.foo {
    height: 100%;
do not render correctly if the top line of your HTML is something similar to:
<!DOCTYPE html
  PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

The major problem with this is that (X)HTML doesn't validate if the DOCTYPE
isn't on the first line.

Reproducible: Always

Steps to Reproduce:

Comment 1

15 years ago
Upon further research, it appears it also affects padding attributes.
Having the DOCTYPE specified creates a 1em padding on the bottom of table cells
containing forms.
Removing the DOCTYPE makes this go away.

Comment 2

15 years ago
doctype triggers strict-compliance mode.
You should also test latest 1.3a build to check if this this also happen, can
you attach a testcase ?

Comment 3

15 years ago
I think, this is dupe of bug 19961. I think bug 19961 comment 57 provides a
testcase for this case. 

Comment 4

15 years ago
Created attachment 110695 [details]
Test Case XHTML that is valid but doesn't work

Validates as XHTML 1.0 Transitional but doesn't render correctly. Seems to
render correctly under IE.
Requires default.css (also attached to work)

Comment 5

15 years ago
Created attachment 110696 [details]
A working example of the testcase that doesn't validate

This is a modification on the test case, leaving out the DOCTYPE therefore
making it work.

Comment 6

15 years ago
Created attachment 110697 [details]
The CSS for my testcases

Comment 7

15 years ago
OK, I added a testcase, a demonstration of what it does without the DOCTYPE and
the CSS. They are all taken from my current project which is how I discovered
the bug. 

Comment 8

15 years ago
For XMTML there is bug 158439 with this case.

Comment 9

15 years ago
See bug 115421. Bug 115421 comment 6 have a simple description of this behaviour.

Comment 10

15 years ago
And also try this with a newer build.

Comment 11

15 years ago
It also happens with 1.2b, I'm not sure what's happening with 1.3a that seems to
be a little garbled, investigating at the moment.

Comment 12

15 years ago
Hmm, my 1.3a problem was fonts related.
However, the bug is still there. It doesn't go full screen with the DOCTYPE

Comment 13

15 years ago
Davyd, do you read Bug 115421 comment 6? There is stated, that 100% mean's not
"full viewport" height, but full parent node heigh -- so it is mean (in
standarts mode) that 100% counting from body -- so you see correct behavior.

<html style="height: 100%;">
  <body style="margin: 0px; height: 100%;">
    <table height="100%">

if you want to obtain viewport height.

Comment 14

15 years ago
ok, so this work nicely it seems.

Is this actually in the standard? Or is it just a work-around?
It's in the standard.
Last Resolved: 15 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.