Forum Moderators: open

Message Too Old, No Replies

Doctypes and Browser Rendering

Strict vs Transitional

         

trillianjedi

10:49 am on Aug 8, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The Jedi has been digesting some good reading on DocTypes in this forum ;)

So, I now know that no doctype (or invalid/outdated) throws a browser into this so called "quirks" mode and I know the implications of that. Recommended reading on that here:-

[webmasterworld.com...]

The question I can't seem to find out the answer to is whether strict, if your code complies with it, is better than transitional for any reason whatsoever (and if so, what's the reason?).

I believe my HTML code probably does comply with the strict doctype - I inserted the appropriate strict doctype into a header and immediately validated OK using the W3C validator.

I can easily test sections at a time and update the DocType where it complies (or fix the code that doesn't), but I guess my question is whether or not doing so is a waste of time, if there's nothing wrong with transitional and it makes no practical or cosmetic difference?

There was a thread which touched on this back in '03 but it didn't really conclude. There's also a post in there that implies that different browsers interpret the use of DocTypes in slightly different ways?

[webmasterworld.com...]

I've been left a little confused on this one narrow issue - whether one is preferable over the other and for what reasons if any.

TJ

tedster

5:55 pm on Aug 8, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Learning all the deprecated attributes and then moving that kind of code out of the html and into css (which seperates content from style) makes for a much leaner html document. And that separation also makes it easier to code for different user agents and devices.

The often discussed content-to-code ratio spikes upward in the conversion to strict -- and yes, it does seem like my strict code also generates pages that rank more easily on search engines. In addition, the html document is a lot easier for a human being to read and edit.

Two years back I made my first conversion for a client from a transitional site to a strict html 4 site, and their search engine traffic popped within a few weeks. So far, search traffic has never again has been problematic.

henry0

8:29 pm on Aug 8, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Could anyone second Tedster?

RonPK

10:15 pm on Aug 8, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



For the record: one can of course use a transitional doctype in a document that complies with the strict standards. Add the URL to the transitional doctype and it should render as standards compliant.

I don't think that search engines care about the doctype used. As tedster already said, they probably prefer content over tagsoup.

encyclo

1:50 am on Aug 9, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



There is a very slight difference in rendering modes between the "full" HTML 4.01 Transitional doctype and the HTML 4.01 Strict doctype. In the former case, the following doctype:

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

triggers an "Almost Standards mode" in Firefox (and all but the earliest Gecko-based browsers). The following doctype:

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

triggers the full Standards Compliance mode. The difference can be seen in the way Firefox handles content within table-cells, so if you are using tables for layout in any way you need to check for any difference if you switch to a Strict doctype.

Other than that one aspect, switching between a "full" transitional doctype and a strict one will have no bearing on either the rendering mode in the browser or on how the document is handled by a search engine spider. In neither case does the user agent attempt to validate the document against the declared doctype.

A doctype on a page has two functions - the first (official) function is to allow you to use a validator to check the syntax of your markup to a formal grammar (specification) as defined by you. In your case, HTML 4.01 Strict is a subset of HTML 4.01 Transitional, as it is the same standard just with presentational elements and attributes removed. The second function is the switch for the browser rendering-mode as described above.

Using HTML 4.01 Strict has two advantages: the first is that you are forcing full standards-compliance mode in all modern browsers. This is the best long-term strategy for maintaining cross-browser compatibility. The benefits of using a Strict doctype over the "full" transitional doctype are very marginal, however. The second advantage is that the validation process will help you in replacing the usage of presentational elements and attributes in your documents with their CSS equivalents - this as tedster says above is good on several levels: content-to-code ratio, overall page size and better accessibility being several advantages.

If your pages render correctly when declaring HTML 4.01 Strict, then you can gradually switch over to that doctype even if on occasion you are still using markup which is considered invalid strict HTML but valid transitional HTML. However a validated HTML transitional page which already contains little or no deprecated elements will get little or no boost simply from a doctype change.

g1smd

10:26 am on Aug 27, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Related thread: [webmasterworld.com...]