NYCPHP Meetup

NYPHP.org

[nycphp-talk] And the HTML guru is....

Greg Rundlett greg.rundlett at gmail.com
Thu Jan 4 21:46:15 EST 2007


On 1/4/07, Kenneth Downs <ken at secdat.com> wrote:
> Hi folks,
>
> A helpful HTML guru has given me the solution to my height-dont-work
> problem in IE 6.
>
> The guru is.... (drumroll)  Tom Melendez of LIPHP fame.  He pointed out
> that changing the document type declaration to "quirks" mode makes IE
> work, instantly fixing the problem.
>
> For completeness, here is a simplified snipeet that illustrates the
> fixed situation:
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
> <html>
> <head>
>    <style>
>    html, body {
>       height: 100%;
>       width: 100%;
>       margin: 0px;
>    }
>    </style>
> </head>
> <body>
> <center>
>    <table cellspacing=0
>           style="width: 500px; height: 100%;">
>    <tr><td style="height: 100px" bgcolor=red>a </td></tr>
>    <tr><td>hello </td></tr>
>    <tr><td style="height: 100px" bgcolor=blue>b </td></tr>
>    </table>
> </center>
> </body>
>
>
>


I don't mean to be picky, but if you post a 'solution' then it ought
to be or attempt to be syntactically correct.  The simple snippet
above gets lazy about quoting attributes, ending semi-colons and the
type attribute is even missing from the <style> tag not to mention a
missing </html> tag.  Your point is made about doctype declarations,
but the code example would lead a newbie to believe that tag soup is
acceptable to 'gurus'.  All I had to do to produce the version below
was run it through tidy -im -ashtml /tmp/tmp.html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
  <meta name="generator" content=
  "HTML Tidy for Linux/x86 (vers 1 September 2005), see www.w3.org">

<style type="text/css">
  html, body {
     height: 100%;
     width: 100%;
     margin: 0px;
  }
</style>

  <title></title>
</head>

<body>
  <center>
    <table cellspacing="0" style="width: 500px; height: 100%;">
      <tr>
        <td style="height: 100px" bgcolor="red">a</td>
      </tr>

      <tr>
        <td>hello</td>
      </tr>

      <tr>
        <td style="height: 100px" bgcolor="blue">b</td>
      </tr>
    </table>
  </center>
</body>
</html>


hth,

Greg

-- 
A: Yes.
> Q: Are you sure?
>> A: Because it reverses the logical flow of conversation.
>>> Q: Why is top posting annoying in email?



More information about the talk mailing list