homepage Welcome to WebmasterWorld Guest from 54.227.146.68
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / HTML
Forum Library, Charter, Moderators: incrediBILL

HTML Forum

    
How do I know what is the correct DOCTYPE for validating?
linton




msg:605222
 12:44 pm on Jan 25, 2004 (gmt 0)

I hope this is the correct forum to address this issue?
I have a simple website written in basic HTML although I realise that the HTML is very bloated and contains many errors. So I am now self-learning and changing my site to CSS and I am trying to validate via W3C on each and every step.
But I do not know what DOCTYPE my documents should be. I have accessed W3C's page for listing the different DOCTYPES but, to be honest, I am still just as confused!
My site has a basic CSS stylesheet which validates OK, but how do I find out what DOCTYPE my HTML docs are?

 

bird




msg:605223
 1:03 pm on Jan 25, 2004 (gmt 0)

how do I find out what DOCTYPE my HTML docs are?

As long as they contain "many errors" as you say, they aren't... ;)

Seriously, that's up to you to decide. Select the HTML version that serves your purposes best, and then code your pages according to the respective standard. If you're transitioning old code, then one of the "transitional" versions will make things easier, because those support constructs that are deprecated in the "strict" versions.

I think the most popular versions are HTML 4.0.1 [w3.org] for the more traditionally inclined, and XHTML 1.0 [w3.org] for the progressive minds.

linton




msg:605224
 1:37 pm on Jan 25, 2004 (gmt 0)

Bird,
Very funny - at least you brightened up my wet weekend!
I checked out your link for HTML4.0.1 and saw that it was a lengthy page - and this was only the CONTENTS! i don't think i would ever have time to read all that!
I am self-taught in HTML from the web and have no idea what version I have learnt - maybe it is a mixture of many versions as I used many different websites!
Should I just put a DOCTYPE as HTML4.0.1 and try to validate it via W3C, and if there are too many errors then try to validate it as XHTML 1.0?
Don't suppose there is an idiots way to find out which is the correct type - for an idiot of course?

Farix




msg:605225
 3:31 pm on Jan 25, 2004 (gmt 0)

If you get a lot of errors with HTML 4.01, then you are likely to get more errors with XHTML 1.0.

encyclo




msg:605226
 3:37 pm on Jan 25, 2004 (gmt 0)

If you're not sure, use this one:

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

If it seriously mucks up your page, then chop off the URL, and use this:

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

This is the DOCTYPE for HTML 4.01 Transitional, which is the most forgiving specification. I wouldn't bother with XHTML until you become much more familiar with validation and web standards, if at all, but you may want to move to HTML 4.01 Strict later on.

The full list of valid DOCTYPEs is here:

[w3.org...]

Hope this helps!

bird




msg:605227
 4:03 pm on Jan 25, 2004 (gmt 0)

wet weekend

Wet? The tramways stopped operating here, because they got stuck in the snow...

Should I just put a DOCTYPE as HTML4.0.1 and try to validate it via W3C, and if there are too many errors then try to validate it as XHTML 1.0?

Validating to HTML 4.0.1 is what I'd recommend as a start. XHTML is very similar to that, just that it's less forgiving about syntax. If you want to switch to XHTML later, then you'll have to write all your tags and attribute names in lowercase, close all tags, and adhere to other similar formalities.

If it seriously mucks up your page, then chop off the URL [off the doctype],

This is equivalent to having no doctype at all, which means that the browser goes into "quirks" mode. It will usually emulate as many old browser bugs as possible, in order to render broken HTML "as intended". If you want your pages to be valid HTML, don't do this.

linton




msg:605228
 5:12 pm on Jan 25, 2004 (gmt 0)

Great info guys - I'm really pleased that I joined this forum. Just hope I can give as much back in the future.
Hope the snowmen melt soon.
Cheers,
Paul

WeirdoPL




msg:605229
 9:39 pm on Jan 26, 2004 (gmt 0)

A few questions...
Since XHTML is less forgiving why bother using it?
What are the benefits of XHTML when compared to HTML?
Can You make exactly the same layout in loose & strict HTML?
What's the use of validation since most browsers don't seem to crash on the layout even if it has more than 200 validation errors?

Please take this one seriously - I think that many people (especially the forum begginers) don't really know the answers to those questions...

grahamstewart




msg:605230
 11:36 pm on Jan 26, 2004 (gmt 0)

Since XHTML is less forgiving why bother using it?

Contrary to the beliefs of your local church, forgiveness is not always a virtue. The more forgiving a browser, the more it is having to 'guess' what you meant and therefore the more room for errors.

Can You make exactly the same layout in loose & strict HTML?

Yes. Loose HTML lets you use deprecated tags, which is handy for those who are converting an existing page. For new pages I would aim to use strict html, particularly where backwards compatability with ancient browsers is not required.

What's the use of validation since most browsers don't seem to crash on the layout even if it has more than 200 validation errors?

Okay, your page looks okay in Internet Explorer, so why bother validating? Well:

  • search engine bots like valid code, or rather, they hate invalid code as it may cause them to barf and miss half your site out

  • Properly validated code, that is correctly marked with a doctype, stands the best chance of being future proof. Whereas invalid code may break on the next browser version when they change how they handle the errors.

  • valid code also stands the best chance of working correctly on different browsers, since they don't have to 'guess' how to display your page.
  • bird




    msg:605231
     12:44 pm on Jan 27, 2004 (gmt 0)

    Since XHTML is less forgiving why bother using it?

    Because some time in the (possibly far away) future, browsers will stop supporting the older HTML versions. This doesn't mean that you need to change all your existing pages right now, but there's no point in writing new pages in HTML 4.0.1, when you can use the future proof XHTML 1.0 with the same effort.

    What's the use of validation since most browsers don't seem to crash on the layout even if it has more than 200 validation errors?

    In the worst case, the page may be completely invisible in standards conforming browsers (most commonly because of missing </table> tags), or its contents may get ignored by search engine spiders.

    When working with (or writing) software, there's an old principle that will give you the best results in widely varying situations and environments: Be relatively generous in the data you accept, but very strict in the data you create. Just because Microsoft writes sloppy code doesn't mean you have to do the same.

    brandboerge




    msg:605232
     1:23 pm on Jan 27, 2004 (gmt 0)

    - Can Doctype be replaced with this code:
    <meta http-equiv="content-type" content="text/html;charset=ISO-8859-1">?
    - Or should both be in the document?
    - Or should the http-equiv not be used?

    grahamstewart




    msg:605233
     1:46 pm on Jan 27, 2004 (gmt 0)

    Can Doctype be replaced with this code:
    <meta http-equiv="content-type" content="text/html;charset=ISO-8859-1">?

    You require both in for your document to be valid [validator.w3.org].

    Doctype specifies which version of (X)HTML you are using, whereas Content-Type specifies the character set you have used.

    there's no point in writing new pages in HTML 4.0.1, when you can use the future proof XHTML 1.0 with the same effort.

    I'll stick with HTML4.01 strict thanks.

    I don't see the point in going to XHTML until more clients can handle the "application/xhtml+xml" MIME type properly and if you are simply serving the XHTML as text/html then what is the point?

    See..

  • W3C: XHTML Media Types [w3.org]
  • "Sending XHTML as text/html Considered Harmful" at http://www.hixie.ch/advocacy/xhtml
  • and this thread: [webmasterworld.com...]
  • davidpbrown




    msg:605234
     1:51 pm on Jan 27, 2004 (gmt 0)

    related thread from last month: I'm new to validation [webmasterworld.com]

    bird




    msg:605235
     7:57 pm on Jan 27, 2004 (gmt 0)

    I don't see the point in going to XHTML until more clients can handle the "application/xhtml+xml" MIME type properly and if you are simply serving the XHTML as text/html then what is the point?

    The main point is that you won't have to change it again in the future.
    Remeber that valid XHTML 1.0 is also valid HTML 4.0.1, but not necessarily the other way round. So you can just declare it as HTML 4.0.1 now, but write it so that it satisfies the stricter XHTML requirements. And once you think that your visitors are ready for XML, just switch the doctype, and you're done!

    tedster




    msg:605236
     8:06 pm on Jan 27, 2004 (gmt 0)

    I don't think the shift to XHTML is nearly so big as the switch to HTML4.01 strict. If you make that switch, the conversion to XHTML strict is not so very big, should you ever need to make it.

    The forgiving doctypes are the transitional ones. If you write transitional XHTML, you've still got some big bumps in the road ahead.

    davidpbrown




    msg:605237
     8:09 pm on Jan 27, 2004 (gmt 0)

    If you're going to do XHTML you might as well declare it as such.
    As suggested here [xml.com] "HTML compatible" XHTML (as defined in appendix C of the XHTML 1.0 specification) may be served as text/html, but it should be served as application/xhtml+xml. This is probably the sort of XHTML you're writing now, so you could go either way."

    It's only XHTML 1.1 that should not be served as text/html.

    MrMcTerse




    msg:605238
     12:29 am on Jan 29, 2004 (gmt 0)

    Okay, so I understand well enough the need for error-free code, and strict being better than transitional for new pages, since one is forced to do away with all the deprecated tags. But the nagging question is, which ml to use, seriously--html 4.01 or xhtml 1.0?

    If, as the circulars warn, xhtml that is being served as text/html, for the sake of renderablility in older browsers, is NOT xhtml, would it make more sense to stick with html 4.01 strict?

    Folks don't seem too optimistic about browser technology catching up with xml in the very near future--some are suggesting it will 2007 before true application/xhtml+xml, will be able to replace text/html. Where do we, the greenhorns put our stick in the mud?

    Here I was trying so hard to make the change to xhtml 1.0 Strict, and then I run across these articles saying to stick with html 4.01. Can anyone clear up the confusion?

    davidpbrown




    msg:605239
     9:03 am on Jan 29, 2004 (gmt 0)

    Another thread is current in Webmaster Business Issues and makes the case for XHTML being future complient.Why XHTML 1.1/CSS? [webmasterworld.com]

    spud01




    msg:605240
     9:34 am on Jan 29, 2004 (gmt 0)

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

    But does it have any real to anyone now a-days?

    Ok so its there to ensure you page complies with HTML Broswers so you get the best results on those browsers.

    I just wonder if every one of 5,000+ page for one of my sites, needs to have a doctype header. Is it a big mistake not to have it, will your site be hindered without out.

    What are the reals reasons now that we are in 2004?

    mattur




    msg:605241
     2:50 pm on Jan 29, 2004 (gmt 0)

    Bird:
    Because some time in the (possibly far away) future, browsers will stop supporting the older HTML versions.

    I doubt any browser will drop html support in the medium term due to the billions of dodgy html pages out there. In your predicted future, who will re-write all these pages? If these pages aren't re-written, why would users upgrade to a newer browser that decreases the number of websites they can view?

    This doesn't mean that you need to change all your existing pages right now, but there's no point in writing new pages in HTML 4.0.1, when you can use the future proof XHTML 1.0 with the same effort.

    Why rely on browsers' non-standard error handling routines to render your xhtml page now, when converting (good) html to xhtml is trivially simple to do should the requirement ever arise? Since it is so easy to transform html to xhtml, html is no less future proof than xhtml.

    This future proofing stuff is FUD. xhtml is currently a (badly supported) solution in search of a problem.

    Global Options:
     top home search open messages active posts  
     

    Home / Forums Index / Code, Content, and Presentation / HTML
    rss feed

    All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
    Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
    WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
    © Webmaster World 1996-2014 all rights reserved