Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HTML strict 4.01 vs XHTML 1.0 transitional

Status
Not open for further replies.

livefree

Programmer
Jun 27, 2005
12
US
I'm a newbie at upgrading to XHTML (ie, been at it about 2 weeks), but have been a software professional for 38 years.

I seek both specific & general advice.

SPECIFIC.

Via use of Tidy, have upgraded a CSS-intensive Web page. W3C validates the page as HTML 4.01 strict.

Decided to upgrade the page to XHTML 1.0 Transitional. Not a big deal. The only change necessary was closing tags like <br> & <img>, adding a " /" before the ending ">". W3C validates this page as XHTML 1.0 Transitional.

Here's the problem. To conform to XHTML, the " /" is required to close both the <link> & <meta> tags. However, the page no longer validates as HTML 4.01 strict. In fact, the specific error message warns of this backwards incompability.

Here are the questions:

(1) Is there some way to have the <link> & <meta> tags validate as both?
(2) Is this even desirable?
(3) Is this even necessary?

GENERAL

Getting back to the real world, the above issue is part of this question: Which is better, HTML 4.01 strict or XHTML 1.0 transitional?

Henri Sivonen in his "Activating the Right Layout Mode Using the Doctype Declaration" article at recommends not using a XHTML 1.0 Transitional DOCTYPE since it causes more browsers to go into quirks mode. Of all the articles I've found re this issue, his seems to embody the most detailed analysis.

Re the real world. Here are the DOCTYPE's used by 10 Top 100 sites on their Home Pages:

o None: Google, eBay, Amazon
o HTML 4.0 Transitional: Microsoft, New York Times
o HTML 4.01 Transitional: Yahoo, the BBC, CNN
o XHTML 1.0 Transitional: Mapquest, Wikipedia

Sure, these sites may still be using legacy code, but the XHTML 1.0 recommendation was published December 1999. 5-1/2 years seems like more than enough time for these major Web-oriented sites to upgrade to XHTML.

Sivonen's article & the results of the survey I did raise a red flag: In the real world, Is there something inherently wrong with using both HTML 4.01 strict & XHTML transitional DTD's?

I'm willing to upgrade my site to XHTML 1.0 transitional, or even 1.0 strict, 1.1 strict, or 2.0 when it becomes official. That's not the problem. The relatively small penalty that validated HTML/XHTML assesses is more than compensated for by the assurance that different browsers will render the same HTML/XHTML the same -- at least, that's the intent, isn't it?

In essence, using Supply Sergeant or Polish peasant mentality here, what is the best alternative, and why?

Thanks very much in advance for your valuable time.

livefree
 
I must say that I had no problems with cross-browser compatibility when it came to having a doctype -- any doctype. For most browsers, I believe having a correct and valid doctype (be it html or xhtml, transitional or strict), shifts the browser in standards mode.

As for your specific question, I have never realized that html doctypes do not allow meta tags to be closed. I don't think it is a big deal. If you use xhtml, close them if you use html, don't. There should be no compatibility issues one way or another.

As for the real world, I don't think any of the websites you checked are an authority on html coding. Microsoft was even intentionally making pages that displayed incorrectly in other browsers. I think it is beneficial to have a website that conforms to the standards and that page will continue to appear correctly in future browsers. That is what I believe -- check A List Apart for coding techniques and use google for searching the net, Mapquest for maps and CNN for news. That is my suggestion.
 
I would agree with Vragabond regarding Doctypes.
The only instance of a problem has been with the inclusion of the XML declaration, which can be left out. But this was not a major issue and I hae even overcome that problem with some better XHTML/CSS.

and again regarding the META tags.
You don't create pages to validate against 2 different Doctypes. It's either/or.

To my mind the benefit of using XHTML over HTML is that XHTML, being much stricter, is more condusive to creating purely structural documents. This is a *good thing* and can go some way to improving accessibility and compatibility.
The stricter the doctype the more likely your pages are going to work in "non standard" scenarios.

Foamcow Heavy Industries - Web design and ranting
Target Marketing Communications - Advertising, Direct Marketing and Public Relations
I wonder what possesses people to make those animated gifs. Do you just get up in the morning and think, "You know what web design r
 
vragabond,

"For most browsers, I believe having a correct and valid doctype (be it html or xhtml, transitional or strict), shifts the browser in standards mode."

Sivonen's Activating the Right Layout Mode Using the Doctype Declaration article, last updated 05/05/05, seems to detail differences between HTML 4.01 transitional & strict for Mozilla Firefox. The difference is minor: A Strict declaration causes Mozilla to use Standard mode, but no Transitional declaration does any better than almost-standard mode, and, in fact, puts other browsers into quirks mode. Almost-standard mode "implements the vertical sizing of table cells traditionally and not rigorously according to the CSS2 specification", so this difference seems not to be a big deal. However, even though IE & FF comprise 90% of browser usage (97% at W3Schools), it appears Strict is better than Transitional, particularly for NS6 & Konqueror.

As before, this conclusion is not real world.

A List Apart seems a good resource. Thanks.

livefree
 
Foamcow,

"The only instance of a problem has been with the inclusion of the XML declaration, which can be left out."

Sivonen's article does detail that an XHTML Strict Doctype with an XML declaration puts IE6 & Konquerer into quirks mode.

"To my mind the benefit of using XHTML over HTML is that XHTML, being much stricter, is more condusive to creating purely structural documents."

Makes much sense. Thanks.

livefree
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top