Footer & DOCTYPE

Discussion in 'HTML' started by Goran Topic, Dec 3, 2003.

  1. Goran Topic

    Goran Topic Guest

    Hello. I'm trying to make a footer, and I tried this (our site uses
    table-based layout; don't kill me, please):

    <table width="100%" height="100%">
    <tr><td>
    CONTENT HERE...
    </td></tr>
    <tr height="20px" bgcolor="blue"><td>
    This is the footer
    </td></tr>
    </table>

    And this works as I want it to: if the page is longer than the screen,
    the footer goes at the bottom of the document; and if it's shorter, it
    goes on the bottom of the screen. However, if I put the DOCTYPE
    declaration, it does not work any more:

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

    Can someone help me get this right? I should have the DOCTYPE, but I've
    no idea how to get the same functionality with it.

    Thanks,

    Goran
     
    Goran Topic, Dec 3, 2003
    #1
    1. Advertising

  2. Goran Topic wrote:
    > Hello. I'm trying to make a footer, and I tried this (our site uses
    > table-based layout; don't kill me, please):


    Just call it "hybrid layout" to make it buzzword compliant ;-)


    > <table width="100%" height="100%">
    > <tr><td>
    > CONTENT HERE...
    > </td></tr>
    > <tr height="20px" bgcolor="blue"><td>
    > This is the footer
    > </td></tr>
    > </table>
    >
    > And this works as I want it to: if the page is longer than the screen,
    > the footer goes at the bottom of the document; and if it's shorter, it
    > goes on the bottom of the screen. However, if I put the DOCTYPE
    > declaration, it does not work any more:
    >
    > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    > "http://www.w3.org/TR/html4/loose.dtd">
    >
    > Can someone help me get this right? I should have the DOCTYPE, but I've
    > no idea how to get the same functionality with it.


    The TABLE element doesn't have a height attribute, see the HTML
    specification: <http://www.w3.org/TR/html4/struct/tables.html#edef-TABLE>.

    You don't say which browser you tested this in. Without the Doctype,
    some browsers will just ignore the specification and apply the height
    attribute. With the Doctype, same browsers will respect the
    specification, and that means it will ignore the attribute.

    Possible solution: Specify the height of the table (or its content) with
    CSS.


    Matthias
     
    Matthias Gutfeldt, Dec 3, 2003
    #2
    1. Advertising

  3. Goran Topic

    brucie Guest

    in post <news:>
    Goran Topic said:

    > (our site uses table-based layout; don't kill me, please):


    i'm sorry but it just doesn't work like that. death is really the only
    solution. why should we kill everyone else and not you? are there
    mitigating circumstances we should be aware of?

    --
    brucie
    04/December/2003 12:44:51 am kilo
     
    brucie, Dec 3, 2003
    #3
  4. Goran Topic

    Steve Pugh Guest

    Goran Topic <> wrote:

    >Hello. I'm trying to make a footer, and I tried this (our site uses
    >table-based layout; don't kill me, please):


    Okay. But I think you know why you're having problems.

    ><table width="100%" height="100%">
    > <tr><td>
    > CONTENT HERE...
    > </td></tr>
    > <tr height="20px" bgcolor="blue"><td>


    That's wrong. The height attribute takes either a percentage or a
    straight numerical value. It never takes a value with "px" tacked on
    the end. Be careful that you don't mix up CSS and HTML syntax (lengths
    in CSS must always have a unit, only percentage lengths in HTML have
    units).

    > This is the footer
    > </td></tr>
    ></table>
    >
    >And this works as I want it to: if the page is longer than the screen,
    >the footer goes at the bottom of the document; and if it's shorter, it
    >goes on the bottom of the screen. However, if I put the DOCTYPE
    >declaration, it does not work any more:
    >
    ><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    >"http://www.w3.org/TR/html4/loose.dtd">


    That doctype triggers standards mode in certain browsers (IE5 Mac, IE6
    Win, Gecko based browsers, Opera 7) and in standards mode the invalid
    height="100%" is ignored.

    > I should have the DOCTYPE, but I've no idea how to get the same functionality with it.


    Why should you have the doctype? If you have <table height="100%">
    then your page is _not_ HTML 4.01 Transitional so putting that doctype
    there is telling a lie.

    Either get rid of the height attribute or get rid of the doctype.

    Or if you want to carry on telling lies you can change the doctype to
    one that triggers quirks mode rather than standards mode (for example,
    just delete the URL from the one above).

    Steve

    --
    "My theories appal you, my heresies outrage you,
    I never answer letters and you don't like my tie." - The Doctor

    Steve Pugh <> <http://steve.pugh.net/>
     
    Steve Pugh, Dec 3, 2003
    #4
  5. Goran Topic

    DU Guest

    Goran Topic wrote:

    > Hello. I'm trying to make a footer, and I tried this (our site uses
    > table-based layout; don't kill me, please):
    >
    > <table width="100%" height="100%">
    > <tr><td>
    > CONTENT HERE...
    > </td></tr>
    > <tr height="20px" bgcolor="blue"><td>
    > This is the footer
    > </td></tr>
    > </table>
    >
    > And this works as I want it to: if the page is longer than the screen,
    > the footer goes at the bottom of the document; and if it's shorter, it
    > goes on the bottom of the screen. However, if I put the DOCTYPE
    > declaration, it does not work any more:
    >
    > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    > "http://www.w3.org/TR/html4/loose.dtd">
    >
    > Can someone help me get this right? I should have the DOCTYPE, but I've
    > no idea how to get the same functionality with it.
    >
    > Thanks,
    >
    > Goran


    Why didn't you just use entirely valid code in a tableless webpage
    design? This is where your markup code and design will work on a
    multitude of web-aware devices, platforms, compliant browsers, etc..
    If you really need to use a table for tabular data, then why not use the
    tfoot element?

    http://www.w3.org/TR/html401/struct/tables.html#h-11.2.3

    Can you give an url of your webpage? That way, we could better suggest a
    way for you to achieve your webpage requirements with web standards
    compliance.

    DU
     
    DU, Dec 4, 2003
    #5
  6. Goran Topic

    Nico Schuyt Guest

    DU wrote:
    >> Hello. I'm trying to make a footer, and I tried this (our site uses
    >> table-based layout; don't kill me, please):
    >> <table width="100%" height="100%">
    >> <snip>
    >> </table>
    >> And this works as I want it to: if the page is longer than the
    >> screen, the footer goes at the bottom of the document; and if it's
    >> shorter, it goes on the bottom of the screen. However, if I put the
    >> DOCTYPE declaration, it does not work any more:


    > Why didn't you just use entirely valid code in a tableless webpage
    > design? This is where your markup code and design will work on a
    > multitude of web-aware devices, platforms, compliant browsers, etc..


    Well, I'm not so sure about that
    http://www.nicoschuyt.nl/test/footer.htm is an example of a tableless
    solution for scrollable text with footer.
    Bad keyboard navigation however and in browsers like Opera7.2 and Mozilla1.4
    the scroll mouse is inactive.
    Probably even more problems than frames :)
    Nico
     
    Nico Schuyt, Dec 4, 2003
    #6
  7. Goran Topic

    brucie Guest

    in post <news:3fcefaeb$0$4663$>
    Nico Schuyt said:

    >> Why didn't you just use entirely valid code in a tableless webpage
    >> design? This is where your markup code and design will work on a
    >> multitude of web-aware devices, platforms, compliant browsers, etc..


    > Well, I'm not so sure about that
    > http://www.nicoschuyt.nl/test/footer.htm is an example of a tableless
    > solution for scrollable text with footer.
    > Bad keyboard navigation however and in browsers like Opera7.2 and Mozilla1.4
    > the scroll mouse is inactive.
    > Probably even more problems than frames :)


    a simpler solution would have just been to position a <div> at the
    bottom of the window (or anywhere else you wanted it) with
    position:fixed; so it remains in the location while everything else
    scrolls.

    easy peasy except once again for IE. you'll need the position fixed
    fix. http://devnull.tagsoup.com/fixed/


    --
    brucie
    04/December/2003 07:25:38 pm kilo
     
    brucie, Dec 4, 2003
    #7
  8. Steve Pugh <> wrote:

    > Or if you want to carry on telling lies you can change the doctype to
    > one that triggers quirks mode rather than standards mode


    Alternatively, if you wish to tell the truth and you wish to use a
    doctype declaration, you can create your copy of the Transitional DDT,
    add a line that tells that a table element may have a height attribute,
    upload the DTD onto a Web server, and refer to it your <!doctype>.

    I'm pretty sure this will trigger "bug compatible" (aka. "quirks") mode
    in current bwowsers. It will also let you check the markup syntax using
    an SGML validator - why else would you use a <!doctype>?

    Your page won't conform to any HTML specification, since all
    specifications mandate the use of specific DTDs, even up to using a
    specific way of referring them. But the great majority of Web pages
    fails to conform, and virtually all bwowsers fail too, so you shouldn't
    feel too sinful.

    --
    Yucca, http://www.cs.tut.fi/~jkorpela/
    Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html
     
    Jukka K. Korpela, Dec 4, 2003
    #8
  9. Goran Topic

    Goran Topic Guest

    In article <bqksrg$242nii$-berlin.de>,
    Matthias Gutfeldt wrote:
    > Goran Topic wrote:
    >> Hello. I'm trying to make a footer, and I tried this (our site uses
    >> table-based layout; don't kill me, please):

    >
    > Just call it "hybrid layout" to make it buzzword compliant ;-)


    Naah... I'll leave that to my bosses. :)

    > The TABLE element doesn't have a height attribute, see the HTML
    > specification: <http://www.w3.org/TR/html4/struct/tables.html#edef-TABLE>.


    That didn't even cross my mind! Thanks...

    > You don't say which browser you tested this in. Without the Doctype,


    IE and Firebird

    Goran
     
    Goran Topic, Dec 4, 2003
    #9
  10. Goran Topic

    Eric Bohlman Guest

    "Jukka K. Korpela" <> wrote in
    news:Xns94477B18C4331jkorpelacstutfi@193.229.0.31:

    > Alternatively, if you wish to tell the truth and you wish to use a
    > doctype declaration, you can create your copy of the Transitional DDT,


    Wasn't it Tina Marie Holmboe who, several years ago, wrote a parody of the
    Ramones' "Teenage Lobotomy" that began with "DTD did a job on me"?
     
    Eric Bohlman, Dec 4, 2003
    #10
  11. Jukka K. Korpela wrote:
    > Steve Pugh <> wrote:
    >
    >
    >>Or if you want to carry on telling lies you can change the doctype to
    >>one that triggers quirks mode rather than standards mode

    >
    >
    > Alternatively, if you wish to tell the truth and you wish to use a
    > doctype declaration, you can create your copy of the Transitional DDT,
    > add a line that tells that a table element may have a height attribute,
    > upload the DTD onto a Web server, and refer to it your <!doctype>.
    >
    > I'm pretty sure this will trigger "bug compatible" (aka. "quirks") mode
    > in current bwowsers.


    It depends. If you advertise the fact that it's your own DTD in the
    Doctype Declaration, it might trigger Standard mode, since any
    unrecognized Doctype triggers "Standard" mode, at least according to the
    browser documentation and my own tests:
    <http://gutfeldt.ch/matthias/articles/doctypeswitch/table.html>

    So one would either have to use a W3C HTML Doctype (which might be seen
    as 'lying'), or with a bit of care create a custom Doctype Declaration
    that isn't recognized as "unknown".


    Matthias
     
    Matthias Gutfeldt, Dec 4, 2003
    #11
  12. Goran Topic

    Steve Pugh Guest

    "Nico Schuyt" <> wrote:
    >DU wrote:
    >>Goran Topic <> wrote:
    >>>
    >>> Hello. I'm trying to make a footer, and I tried this (our site uses
    >>> table-based layout; don't kill me, please):
    >>> <table width="100%" height="100%">
    >>> <snip>
    >>> </table>
    >>> And this works as I want it to: if the page is longer than the
    >>> screen, the footer goes at the bottom of the document; and if it's
    >>> shorter, it goes on the bottom of the screen. However, if I put the
    >>> DOCTYPE declaration, it does not work any more:

    >
    >> Why didn't you just use entirely valid code in a tableless webpage
    >> design? This is where your markup code and design will work on a
    >> multitude of web-aware devices, platforms, compliant browsers, etc..

    >
    >Well, I'm not so sure about that
    >http://www.nicoschuyt.nl/test/footer.htm is an example of a tableless
    >solution for scrollable text with footer.
    >Bad keyboard navigation however and in browsers like Opera7.2 and Mozilla1.4
    >the scroll mouse is inactive.


    However, the OP didn't ask for a fixed footer, but one that went to
    the either the end of the window or the end of the content depending
    on the amount of content. This is doable with CSS and doesn't seem to
    screw up scrolling in any browser I have available for testing:

    http://steve.pugh.net/test/test57.html (long content)
    http://steve.pugh.net/test/test57a.html (short content)

    Steve

    --
    "My theories appal you, my heresies outrage you,
    I never answer letters and you don't like my tie." - The Doctor

    Steve Pugh <> <http://steve.pugh.net/>
     
    Steve Pugh, Dec 4, 2003
    #12
  13. Goran Topic

    Nico Schuyt Guest

    brucie wrote:
    > Nico Schuyt said:


    >> http://www.nicoschuyt.nl/test/footer.htm is an example of a tableless
    >> solution for scrollable text with footer.


    > a simpler solution would have just been to position a <div> at the
    > bottom of the window (or anywhere else you wanted it) with
    > position:fixed; so it remains in the location while everything else
    > scrolls.
    > easy peasy except once again for IE. you'll need the position fixed
    > fix. http://devnull.tagsoup.com/fixed/


    Much simpler indeed. Thanks!!
    Nico
     
    Nico Schuyt, Dec 4, 2003
    #13
  14. Goran Topic

    Nico Schuyt Guest

    Steve Pugh wrote:

    > However, the OP didn't ask for a fixed footer, but one that went to
    > the either the end of the window or the end of the content depending
    > on the amount of content. This is doable with CSS and doesn't seem to
    > screw up scrolling in any browser I have available for testing:
    > http://steve.pugh.net/test/test57.html (long content)
    > http://steve.pugh.net/test/test57a.html (short content)


    Perfect!
    Nico
     
    Nico Schuyt, Dec 4, 2003
    #14
  15. Eric Bohlman <> wrote:

    >> Alternatively, if you wish to tell the truth and you wish to use a
    >> doctype declaration, you can create your copy of the Transitional
    >> DDT,

    >
    > Wasn't it Tina Marie Holmboe who, several years ago, wrote a parody
    > of the Ramones' "Teenage Lobotomy" that began with "DTD did a job
    > on me"?


    I swear by SGML and XML and the holy W3C that "DDT" was an
    unintentional typo. Consult "Psychopathologie des Alltagslebens" for a
    background explanation.

    --
    Yucca, http://www.cs.tut.fi/~jkorpela/
    Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html
     
    Jukka K. Korpela, Dec 4, 2003
    #15
  16. Matthias Gutfeldt <> wrote:

    >> I'm pretty sure this will trigger "bug compatible" (aka. "quirks")
    >> mode in current bwowsers.

    >
    > It depends. If you advertise the fact that it's your own DTD in the
    > Doctype Declaration, it might trigger Standard mode, since any
    > unrecognized Doctype triggers "Standard" mode, at least according
    > to the browser documentation and my own tests:
    > <http://gutfeldt.ch/matthias/articles/doctypeswitch/table.html>


    Excuse me while I get mad.

    And sorry for making guesses on the basis of what would have made at
    least _some_ sense, instead of checking what bwowser vendors actually
    did. Incidentally, it seems that your article is blank (white) for
    Netscape 6 as regards to the mode when an "unrecognized" doctype is
    used - at least Netscape 7.1 seems to follow the crowd, in doing just
    the absurd thing: if I declare a doctype in a manner that definitely
    violates HTML specifications (even if I in fact thereby refer to a DTD
    that is a verbatim copy of a DTD listed in a specification), the
    doctype sniffer decides to switch to "standards" mode.

    > So one would either have to use a W3C HTML Doctype (which might be
    > seen as 'lying'), or with a bit of care create a custom Doctype
    > Declaration that isn't recognized as "unknown".


    Quite interesting options, are they not? So the logical conclusion is
    that the need for declaring a doctype (when you actually want "quirks"
    mode) is nonexistent, except if company police requires it. After all,
    the doctype has two effective meanings:
    a. For SGML validators, as well as some of their imitations, the
    doctype declaration is a way of expressing the intended syntax
    in a manner that allows automatic verification. But the author
    can of course submit a modified copy, which contains a suitable
    doctype.
    b. Browsers play their games, in different ways, modifying the rules
    of the game in a Calvinball-like manner. But if quirks mode is what
    you want, omission of any doctype seems to be the best method
    (at present at least).

    --
    Yucca, http://www.cs.tut.fi/~jkorpela/
    Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html
     
    Jukka K. Korpela, Dec 4, 2003
    #16
  17. "Jukka K. Korpela" schrieb:
    >
    > Matthias Gutfeldt <> wrote:
    >
    > >> I'm pretty sure this will trigger "bug compatible" (aka. "quirks")
    > >> mode in current bwowsers.

    > >
    > > It depends. If you advertise the fact that it's your own DTD in the
    > > Doctype Declaration, it might trigger Standard mode, since any
    > > unrecognized Doctype triggers "Standard" mode, at least according
    > > to the browser documentation and my own tests:
    > > <http://gutfeldt.ch/matthias/articles/doctypeswitch/table.html>

    >
    > Excuse me while I get mad.


    Take your time. Just ring the bell when you're finished smashing the
    furniture and dishes :).


    > Incidentally, it seems that your article is blank (white) for
    > Netscape 6 as regards to the mode when an "unrecognized" doctype is
    > used


    Yes. IIRC I forgot to test it before I banished NN6 from my computer.


    > - at least Netscape 7.1 seems to follow the crowd, in doing just
    > the absurd thing: if I declare a doctype in a manner that definitely
    > violates HTML specifications (even if I in fact thereby refer to a DTD
    > that is a verbatim copy of a DTD listed in a specification), the
    > doctype sniffer decides to switch to "standards" mode.


    Absolutely. This particular problem illustrates nicely that Doctype
    Switch is not only a bad idea, it's also very badly executed.

    Add to this the two following simple observations:

    a) Many authors don't even know about this "feature", and accidently
    trigger "Standard" mode although their document is confused tag-soup, or
    "Quirks" mode although their document follows the specification
    b) Some browsers introduced errors in "Quirk" mode-capable browser that
    they never had in previous versions (Opera,
    <http://www.opera.com/docs/specs/doctype/>)

    It becomes clear, at least to me, that the Doctype Switch should be
    abolished as soon as possible.


    Matthias
     
    Matthias Gutfeldt, Dec 4, 2003
    #17
  18. Jukka K. Korpela wrote:

    > the absurd thing: if I declare a doctype in a manner that definitely
    > violates HTML specifications (even if I in fact thereby refer to a DTD
    > that is a verbatim copy of a DTD listed in a specification), the
    > doctype sniffer decides to switch to "standards" mode.


    To be honest that makes perfect sense to me -- it allows the browser to
    display a theoretical "HTML 5.0"[1] document in standards mode.

    [1] or any possible future HTML-like markup language.

    --
    Toby A Inkster BSc (Hons) ARCS
    Contact Me - http://www.goddamn.co.uk/tobyink/?page=132
     
    Toby A Inkster, Dec 4, 2003
    #18
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ian

    vs.net creates doctype wrong?

    Ian, Jun 20, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    481
  2. Kenneth Keeley

    Setting DocType in Asp.Net

    Kenneth Keeley, Jun 29, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    618
    Cowboy \(Gregory A. Beamer\) [MVP]
    Jun 30, 2004
  3. Neil Zanella
    Replies:
    3
    Views:
    2,581
    John Saunders
    Jan 4, 2005
  4. Henrik
    Replies:
    1
    Views:
    433
    Ken Cox [Microsoft MVP]
    Jul 6, 2006
  5. Larry Lindstrom
    Replies:
    19
    Views:
    1,310
    Jonathan N. Little
    Jun 12, 2012
Loading...

Share This Page