I want to put up hundreds of html pages and I don’t want to have to make changes to the xhtml for several years.
The pages I created using the code shown pass W3C. I have used the word “example” in places in the code
to keep out extraneous info (just for this post).
Is the code below adequate or in need of extra meta-data, other info, or changes?
Is there a particular reason you’re not going with a strict DOCTYPE?
The code is technically OK, but I’d put that into a PHP (or any other programming language) include so that you only ever need to edit a single file instead of a hundred or more, should the need arise.
The reason for not making the DOCTYPE strict is my concern that a strict doctype would not be “compatible” with older browsers.
Is this a possibility or reason for concern?
I will be learning PHP as well as Javascript in the next few months. For the time being I wanted to make some base pages to be found by search engines.
Using a strict DOCTYPE won’t cause any issues with older browsers, HTML4.01 strict won’t even cause problems with messy markup. If you code your HTML document properly, no hiccups can occur, so if that is accounted for then you’re absolutely safe using a strict DOCTYPE. It’s the way to go. I’d also recommend going with HTML 4.01 strict as that is the current standard (rather than using any flavors of XHTML).
That’s what I use now. It’s simpler, and all you need these days.
It’s not a huge issue what doctype you have, as long as you have one, but certainly go for strict if not the one above. Transitional is only for very old websites.
Thanks, Ralph. I studied most of css and html fairly thoroughly over the past few months but then realized I knew little about the stuff goes at the very top of an html page.
Just remember that html5 is still in draft mode. The current standard still is HTML 4.01 and the recommended version by the W3C.
Please note that I’m not in any way recommending against using html5. I use html5 occasionally, many use HTML4.01 with the new html doctype. I’m a bit old-school in that regard. If I use HTML 4.01, I’d like to reflect that in the DOCTYPE. It’s a matter of preference and you can’t go wrong with either.
The doctype I included above is really a generic one that is fine for any flavor of HTML, so far as I know. From a browser’s point of view, there is either a doctype or there isn’t. If no dictype, it goes into quirks mode; if there is a doctype, it assumes it’s a modern site. that’s my understanding, anyhow.
Which doctype you use will matter to a validator, but that’s kind of irrelevant.
It isn’t valid for HTML 1 as HTML 1 doesn’t allow a doctype.
It is valid for any version of HTML from HTML 2 through HTML 4 which are SGML based specifications and where that doctype is the short version of the SGML identifier for the type of document that the standard is for.
It is also valid for HTML 5 which like HTML 1 isn’t SGML compatible and therefore doesn’t follow the document definition standards but which unlike HTML 1 through HTML 4 actually defines that as an HTML tag. So while the same doctype works for HTML 5 as for HTML 2 - one is SGML while the other is THLM.
A deliberate typo - since HTML 5 isn’t SGML it can’t be a markup language since SGML is the standard for defining markup languages. Therefore it must be something else - perhaps a Text HyperLanguage Markdown or something instead. Anyway HTML 5 is non-standard where HTML 2 through 4 all followed the standards. Obviously those involved in HTML 5 don’t care about standards.