Newbie: Placing DOCTYPE tag on HTML file screws up formatting

Discussion in 'HTML' started by KS, Nov 9, 2004.

  1. KS

    KS Guest

    I have just designed my first website from books I have read and resources
    on the net. I designed several pages, but did not put the DOCTYPE tag at
    the beginning, figuring I could put the tag in once I got the pages ready.
    Everything is formatting and working correct until I put in the DOCTYPE tag,
    then the formatting gets screwed up. I must have been mistaken to think the
    DOCTYPE tag was useless except for validation purposes. I could probably
    put my site on the web without the DOCTYPE tag and it would work fine. Can
    anyone tell me why putting the DOCTYPE tag in my HTML file would screw up
    the formatting and layout? Does anyone have any recommendations of what to
    look for or what changes may need to be made? I'd appreciate the help.

    KS
     
    KS, Nov 9, 2004
    #1
    1. Advertising

  2. KS

    Mark Parnell Guest

    On Tue, 9 Nov 2004 15:20:59 -0800, KS <> declared in
    alt.html:

    > Can
    > anyone tell me why putting the DOCTYPE tag in my HTML file would screw up
    > the formatting and layout?


    http://www.google.com/search?q=doctype switching

    > Does anyone have any recommendations of what to
    > look for or what changes may need to be made?


    http://validator.w3.org/
    http://jigsaw.w3.org/css-validator/

    > I'd appreciate the help.


    brucie is in charge of receiving payments.

    --
    Mark Parnell
    http://www.clarkecomputers.com.au
    "Never drink rum&coke whilst reading usenet" - rf 2004
     
    Mark Parnell, Nov 9, 2004
    #2
    1. Advertising

  3. On Tue, 9 Nov 2004 15:20:59 -0800, KS <> wrote:

    > Can anyone tell me why putting the DOCTYPE tag in my HTML file would
    > screw up the formatting and layout?


    Omitting the DOCTYPE causes more recent browsers to enter into "quirks
    mode". Simply put, this emulates the rendering bugs of older browsers when
    they didn't conform to standards. These bugs were perpetuated to ensure
    that legacy pages weren't broken when they were actually rendered
    correctly.

    As modern pages should validate[1] and you should aim to use HTML and CSS
    as they are specified (rather than hacking solutions), you should force
    the browser into "strict mode". One advantage of writing "correct"
    documents is that they tend to render more predictably across the wide
    range of user agents currently in use.

    > Does anyone have any recommendations of what to look for or what changes
    > may need to be made?


    Googling for "quirks mode" will turn up a lot of information on the
    subject, as will just "doctype".

    Something else to add is that it's best, in my opinion at least, to test
    your pages in browsers better than IE (assuming you don't already). Opera
    and Mozilla do a much better job of showing how your pages should actually
    look. IE tends to accept any old rubbish.

    Mike


    [1] See <URL:http://validator.w3.org/> and
    <URL:http://jigsaw.w3.org/css-validator/>.

    --
    Michael Winter
    Replace ".invalid" with ".uk" to reply by e-mail.
     
    Michael Winter, Nov 9, 2004
    #3
  4. KS

    Toby Inkster Guest

    KS wrote:

    > Can anyone tell me why putting the DOCTYPE tag in my HTML file would
    > screw up the formatting and layout?


    Your page was screwed up to begin with. The DOCTYPE fixed it. You just
    happen to prefer how the screwed up version looked.

    --
    Toby A Inkster BSc (Hons) ARCS
    Contact Me ~ http://tobyinkster.co.uk/contact
     
    Toby Inkster, Nov 10, 2004
    #4
  5. "Michael Winter" <> writes:

    > On Tue, 9 Nov 2004 15:20:59 -0800, KS <> wrote:
    >
    >> Can anyone tell me why putting the DOCTYPE tag


    There is no such thing; the document type declaration is a markup
    declaration (even VB programmers should be able to grok that, since it
    starts with the MDO ('markup declaration open') delimiter '<!' (!DUH)).

    >> in my HTML file would
    >> screw up the formatting and layout?


    Because web browser vendors like M$, Mozilla and Opera don't care shit
    about standards.

    > As modern pages should validate[1] and you should aim to use HTML and
    > CSS as they are specified (rather than hacking solutions), you should
    > force the browser into "strict mode".


    You can't *force* IE/windows into "strict mode' (if you need a second
    opinion, ask brucie what happens when he configures IE6 to connect
    through the proxomitron :).

    > One advantage of writing
    > "correct" documents is that they tend to render more predictably
    > across the wide range of user agents currently in use.


    IE6 has new, additional bugs in so-called 'standards compliant mode',
    and M$ explicitly states that its results may not be compatible with
    future versions of IE and should be avoided altogether for fixed media.

    How cool.

    > Googling for "quirks mode" will turn up a lot of information on the
    > subject, as will just "doctype".


    Googling for 'doctype' reveals predominantly BS.


    (Mind me, this is hopeless anyway, but needs to be said now and then)


    --
    | ) Più Cabernet,
    -( meno Internet.
    | ) http://bednarz.nl/
     
    Eric B. Bednarz, Nov 10, 2004
    #5
  6. KS

    C A Upsdell Guest

    "KS" <> wrote in message
    news:...
    >I have just designed my first website from books I have read and resources
    >on the net. I designed several pages, but did not put the DOCTYPE tag at
    >the beginning, figuring I could put the tag in once I got the pages ready.
    >Everything is formatting and working correct until I put in the DOCTYPE
    >tag, then the formatting gets screwed up. I must have been mistaken to
    >think the DOCTYPE tag was useless except for validation purposes. I could
    >probably put my site on the web without the DOCTYPE tag and it would work
    >fine. Can anyone tell me why putting the DOCTYPE tag in my HTML file would
    >screw up the formatting and layout? Does anyone have any recommendations
    >of what to look for or what changes may need to be made? I'd appreciate
    >the help.


    See http://www.upsdell.com/BrowserNews/res_doctype.htm
     
    C A Upsdell, Nov 10, 2004
    #6
  7. KS

    C A Upsdell Guest

    "KS" <> wrote in message
    news:...
    >I have just designed my first website from books I have read and resources
    >on the net. I designed several pages, but did not put the DOCTYPE tag at
    >the beginning, figuring I could put the tag in once I got the pages ready.
    >Everything is formatting and working correct until I put in the DOCTYPE
    >tag, then the formatting gets screwed up. I must have been mistaken to
    >think the DOCTYPE tag was useless except for validation purposes. I could
    >probably put my site on the web without the DOCTYPE tag and it would work
    >fine. Can anyone tell me why putting the DOCTYPE tag in my HTML file would
    >screw up the formatting and layout? Does anyone have any recommendations
    >of what to look for or what changes may need to be made? I'd appreciate
    >the help.


    See http://www.upsdell.com/BrowserNews/res_doctype.htm
     
    C A Upsdell, Nov 10, 2004
    #7
  8. On Wed, 10 Nov 2004 01:17:11 +0100, Eric B. Bednarz
    <> wrote:

    [snip]

    > IE6 has new, additional bugs in so-called 'standards compliant mode',
    > [...]


    Of course it does! It's IE.

    >> Googling for "quirks mode" will turn up a lot of information on the
    >> subject, as will just "doctype".

    >
    > Googling for 'doctype' reveals predominantly BS.


    Googling for many things reveals predominantly BS, but at close to
    midnight, I wasn't about to go check the content of the results. Call me
    lazy, but sleep was a much more attractive idea. They seemed appropriate
    and that was enough for me at the time.

    Mike

    --
    Michael Winter
    Replace ".invalid" with ".uk" to reply by e-mail.
     
    Michael Winter, Nov 10, 2004
    #8
    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. John Holmes
    Replies:
    2
    Views:
    371
    =?Utf-8?B?UGxpc3Nza2lu?=
    Jul 9, 2004
  2. shruds
    Replies:
    1
    Views:
    834
    John C. Bollinger
    Jan 27, 2006
  3. Dwayne
    Replies:
    8
    Views:
    425
    nice.guy.nige
    Feb 28, 2004
  4. thedarkman

    Doctype screws up file

    thedarkman, Feb 20, 2012, in forum: HTML
    Replies:
    6
    Views:
    470
    Beauregard T. Shagnasty
    Feb 21, 2012
  5. Larry Lindstrom
    Replies:
    19
    Views:
    1,307
    Jonathan N. Little
    Jun 12, 2012
Loading...

Share This Page