What would be the best DOCTYPE to use these days?

is HTML 4.01 version ok and compatible with most browsers?

HTML 4.01 strict is now fully supported by all modern browsers.

What about if I html 4.01 doctype and a user open the document in Internet explorer 5 or 6 or any other browser older versions? will it display or it will be comflicting?

It will display; in fact I don’t think Internet Explorer actually uses a HTML DTD “correctly” anyway? Stephen might be able to clarify whether that is the case nowadays.

guys

I tried to validate my web site in it threw this awful message!

Sorry! This document can not be checked.

It is possible your Firewall is blocking things how did you try validation? By Upload, URL or copy-and-paste? I assume it is a text/html HTML file with a .htm extension.

What was the rest of the error message?

cheers,

gary

@xtmlcoder I have tried by url

@gary the rest of the message is as below

Sorry! This document can not be checked.

  1. Error

    Sorry, this type of URL scheme (“”) is not supported by this service. Please check that you entered the URL correctly.

    URLs should be in the form: http://validator.w3.org/

    If you entered a valid URL using a scheme that we should support, please let us know as outlined on our Feedback page. Make sure to include the specific URL you would like us to support, and if possible provide a reference to the relevant standards document describing the URL scheme in question.

    Remember that you can always save the page to disk and Validate it using the File Upload interface.

The index page in the website is index.php

Does it has to be html format?

Yes. You have to run the PHP and generate the HTML and then pass that to the validator. The validator doesn’t understand PHP.

The full doctype is only used by browsers for switching between quirks and standard mode. Any docytpe will trigger standards mode and so get the browser displaying the page as close to the standards as the browser is capable.

The doctype itself is only used by validators in order for you to validate whether your HTML complies with a given standard to at least the extent to which the validator is capable of checking (there are some rules the valudator can’t check).

So an HTML 4 strict doctype validates that you only used HTML 4 tags.

An HTML 4 transitional doctype checks that you used HTML 4 and HTML 3.2 tags

An HTML 3.2 doctype checks that you used HTML 3.2 tags.

An HTML 2 doctype checks that you used HTML 2 tags.

In each case any proprietary tags you use will be reported as an error as will any tags not in that version of HTML.

If you are not planning on running your code through a validator you may as well use the short version of the doctype <!DOCTYPE html> as that is a valid doctype for all versions of HTML from 2 through 4 and is the only part that the browser needs for its mode switching.

HTML 5 which is reverting to the HTML 1 days of not being based on SGML and therefore not having an SGML doctype has declared that in that version of HTML the <!DOCTYPE html> tag is an HTML tag used soley for mode switching in browsers. That allows it to continue to be compatible with the way that browsers use that SGML tag in HTML 2 through 4 for mode switching.

just as in here Where html 1.0 strict don’t allow <title> tags…

 &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
      &lt;html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"&gt;

Error message that indicates that html 1.0 strict doesn’t allow title tags…

 #  Error  Line 15, Column 7: document type does not allow element "title" here

&lt;title&gt;www.consejo.com&lt;/title&gt;

&#9993;

The element named above was found in a context where it is not allowed. This could mean that you have incorrectly nested elements – such as a “style” element in the “body” section instead of inside “head” – or two elements that overlap (which is not allowed).

One common cause for this error is the use of XHTML syntax in HTML documents. Due to HTML’s rules of implicitly closed elements, this error can create cascading effects. For instance, using XHTML’s “self-closing” tags for “meta” and “link” in the “head” section of a HTML document may cause the parser to infer the end of the “head” section and the beginning of the “body” section (where “link” and “meta” are not allowed; hence the reported error).

I wonder how usefull are the title tags, should I use another doctype for this case that display tittle tags?

Did you include the “http://” in the URL?

XHTML 1.0 does allow title tags. It must be somewhere between the <head> and </head> tags.

The error message you are getting indicates that your title tag is not inside the head tag.

that’s what it is…

Do you have a preference among XHTML 1.0 and xhtml 4.0?

I tend to use XHTML (purely because I prefer the stricter semantic rules and the leanings towards XML - I like the yellow errors to fix my mistakes) however as felgall will repeat at great length (amongst others), unless you have a reason to use XHTML you should simply use HTML 4.01 instead. Unless you are serving the XHTML as conventional HTML there will be serious browser incompatibilities (IE for instance), and thus it’s uses are fairly limited. :slight_smile:

Alex, I use XHTML for the same reason you do - knowing that what I am creating is actually slightly invalid HTML but much preferring the stricter validation rules that make the validator more useful. That’s the sort of reason that I consider to be a valid one for using an XHTML doctype while still serving the page as HTML. The reason I don’t recommend it to others is that too many people fall into the trap of thinking that because they are using an XHTML doctype that their page is XHTML when it isn’t. You need to understand the difference between HTML and XHTML properly before deciding to use an XHTML doctype with HTML pages as otherwise you end up in a worse mess rather than gaining any benefit from it.

I’d consider using real XHTML except that IE8 and earlier don’t support it (not sure about whether they are adding support in IE9).

Don’t hold your breath with regards to IE 9 supporting XHTML served as ‘application/xhtml+xml’. There is probably more chance said browser will support the majority of HTML5 first. Out of preference I do serve ‘application/xhtml+xml’ for those that can accept such MIME.

Although of course I am wasting my time doing such but it gives me some sick satisfaction when I see Browser; “Yellow Screen of Death”.

I wouldn’t hold my breath waiting for any browser to support that - we are probably at least ten years away from HTML 5 gets even remotely close to becoming a standard. The only purpose browsers have in including anything from the HTML 5 preliminary draft is so that experimenters can try them out to see which ideas do and don’t work. By the time HTML 5 actually becomes a standard it will probably look a lot different from the way it does now.

The reason I suggested that IE9 might support XHTML is that there has been a lot of talk of their replacing the Trident rendering engine with Gazelle and if they do and Gazelle supports XHTML then IE9 would as well (haven’t seen anything as to whether Gazelle does or doesn’t support it though and also nothing as to whether they actually are using Gazelle).

With the timeframes for when XHTML 1.0 and HTML 5 will be final standards (one about 10 years ago and the other in about 10 years time) I would be very surprised if IE15 did not support XHTML even though it still doesn’t support the yet to be finalised HTML 5. Assuming Microsoft are still bothering to produce a browser by then and that they still have a big enough market share for it to even matter.

If that does happen that will be good news though I personally would still not bother serving XHTML pages application/xhtml+xml as chances are that a lot of people would be stuck with versions 6-8 of IE (some might not have a choice if in an educational establishment or in the workplace) for a while yet.