Document type declaration inserts extra whitespace on page

RESOLVED INVALID

Status

()

Core
Layout
RESOLVED INVALID
16 years ago
16 years ago

People

(Reporter: Janne Jalkanen, Assigned: Marc Attinasi)

Tracking

Trunk
x86
Linux
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

16 years ago
These two files render differently, even though they shouldn't.  Test1.html
applies some extra space on top of the page, test2.html does not.

---test1.html---
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
<html>

<head>
  <title>Test</title>
</head>

<body BGCOLOR="#FFFFFF">

<table BORDER="0" CELLSPACING="8" width="95%">

   <tr>
       <td WIDTH="10%" VALIGN="top" NOWRAP="nowrap">
          <h3>Test</h3>
       </td>

       <td WIDTH="85%" VALIGN="top">
           <h1 CLASS="pagename">Main</h1></td>
       </td>
   </tr>

</table>

</body>

</html>

---test2.html---
<!--
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
-->
<html>

<head>
  <title>Test</title>
</head>

<body BGCOLOR="#FFFFFF">

<table BORDER="0" CELLSPACING="8" width="95%">

   <tr>
       <td WIDTH="10%" VALIGN="top" NOWRAP="nowrap">
          <h3>Test</h3>
       </td>

       <td WIDTH="85%" VALIGN="top">
           <h1 CLASS="pagename">Main</h1></td>
       </td>
   </tr>

</table>

</body>

</html>

---end of test2.html---
(Reporter)

Comment 1

16 years ago
Whoops, for some reason bugzilla got the version number wrong.  This is Mozilla
0.9.5.
Invalid.  This is the as-designed behavior.  The page with a doctype is laid out
in standards mode, whereas that without a doctype is laid out in
backwards-compatible "quirks" mode.  In quirks mode, the first child of a table
cell has no top margin.  So the <h1> and <h3> lose their top margin and you
don't see the space.  In standards mode the <h1> and <h3> keep their margins
(why would they not).

Adding:

td > h1:first-child, td > h3:first-child { margin-top: 0; }

to the stylesheet for the page will get rid of the space.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 16 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.