You are here: Home / Dog Blog / Archives

Strictly Speaking

Wednesday 1 December, 2004 ( 2:07PM GMT)

XHTML Transitional is a form of HTML commonly used by developers. But I'm not quite sure why. As John Oxton recently mentioned, doesn't it kind of miss the point?

XHTML Transitional is just that - a transition. It is designed to help developers make the move from one technical standard - HTML 4 - to another technical standard - XHTML 1 (Strict). This is a great learning step if you're stuck in your HTML 4 ways, but it shouldn't be seen as an ultimate goal. Making the choice to switch to any flavour of XHTML in the first place surely means that the choice has been made to want to do it properly. Starting with Transitional to get to grips with the XHTML syntax is perfectly understandable but it's just a halfway house.

In practical terms, the difference between the Transitional XHTML and Strict XHTML is nothing more than the former allowing more tags and attributes than the latter. This might sound preferable, but it's not, not in the long run. XHTML Strict strips out most of the presentational crap that we're trying to get away from - separating structure and presentation is the key to building better web pages. By applying XHTML Strict we are helping to ensure that as little presentational junk hangs around in the markup as possible.

One increasingly unjustifiable reason why a developer might opt for Transitional XHTML is if they have an unusually perverse need to accommodate older, rarely used browsers. Presentational elements might result in better presentation in browsers such as Netscape 4 but using such elements will be detrimental to the efficiency, and possibly accessibility, of your web pages.

Another reason might be if you are working with other, less knowledgeable people, or even completely handing over your code to someone (such as a client) who wants to add/alter/mangle it as they please. But in these cases, there's not much point in having a doctype at all (because the doctype-less quirks mode is, essentially, for people who don't know what they're doing).

But let's assume that in most cases we're not going to be handing over our da Vinci to a manic toddler with a pack of crayons. And let's assume that the best approach to web design is to separate structure and presentation as much as is possible, because, well, it is. Now, isn't the only sensible conclusion that strict XHTML is the way to go?

Comments

Comment 1

XHTML 1.0 Transitional is just the equivalent of HTML 4.01 Transitional described in XML. Nothing more. Some people have labeled it differently (incorrectly), but that's a different issue.

So said Anne on Wednesday 1 December, 2004 at 2:26PM GMT.

Comment 2

If it were up to me, I would have renamed "Strict" to "Regular" since it is in no way "strict". It is stricter with content/style separation, but that's a good thing (tm)!

So said Gabriel Mihalache on Wednesday 1 December, 2004 at 2:39PM GMT.

Comment 3

I have to confess to using XHTML Transitional for some time. I did this because I was in fact transioning from table layout to CSS layout. I found, and I think many people will find, that just by switching the doctype that your code is very often still valid.

So said mike burnard on Wednesday 1 December, 2004 at 4:50PM GMT.

Comment 4

Good points. Thanks for the "wake up call." I need to start using Strict on all my pages.

It's true that Transitional is just a "cleaned up" HTML 4. Nothing more.

Strict is definitely the way to go.

So said Matthom on Wednesday 1 December, 2004 at 6:38PM GMT.

Comment 5

One big reason for using XHTML Transitional is if you are going to be serving your document as "text/html". Strict versions of XHTML, according to the W3C Note [ http://www.w3.org/TR/xhtml-media-types/ ] on the subject, SHOULD NOT be served as "text/html". Of course, I would argue that if you are going to be serving "text/html", it would be better to use HTML instead of XHTML.

So said Simon Jessey on Wednesday 1 December, 2004 at 6:40PM GMT.

Comment 6

As Simon (Simon Jessey) pointed out, unless you can serve your XHTML strict as 'application/xhtml+xml' there's not really any point of using XHTML strict either. Even if you can serve it as the proper media type, IE6 is going to vommit when it encounters it. Although Firefox is running a good race, we're not to the point of dumping support for IE just yet.

If you are ready to kick it to IE6, I wholeheartedly agree that XHTML strict is the way to go. Otherwise, why not just write good, semantic HTML without the presentational fluff and without the XHTML transitional tag soup?

So said Simon on Wednesday 1 December, 2004 at 7:51PM GMT.

Comment 7

So you'll be changing this site to XHTML Dog? Or maybe just Strict Dog? Sorry, I couldn't stop myself.

So said Jim Cook on Wednesday 1 December, 2004 at 9:23PM GMT.

Comment 8

You "MAY" serve XHTML 1.0 as text/html. You SHOULDN'T server XHTML 1.1 as text/html... that's what the good W3C docs say.

That being said, the entire content type discussion seems pretty irrelevant to me right now since no one is doing anything interesting with content type at this point. Maybe if there were any practical differenced, I would care. Until then, I'm treating XHTML as an XML-ised version of HTML.

So said Gabriel Mihalache on Wednesday 1 December, 2004 at 10:06PM GMT.

Comment 9

I need the noshade attribute. Besides, I like Transitional and I don't see why one is superior over the other. I don't see myself switching to strict in the near future.

So said Dante Evans on Wednesday 1 December, 2004 at 10:42PM GMT.

Comment 10

i still use transitional for 2 reasons... <iframe> which comes in handy in some circumstances and <a target="_blank"> for certain links...

So said k on Wednesday 1 December, 2004 at 10:43PM GMT.

Comment 11

I would love to start using strict, from what ive read it does seems like a much better way or working. Eventually of course I will, this application text/xml/html stuff seems to be cropping up everywhere. I've yet to fully look at the issue and decide what I want to do, so for now i will stick with transitional.

So said Tom on Wednesday 1 December, 2004 at 11:24PM GMT.

Comment 12

Just to chip in regarding comment number ten, you can recreate the target attribute with JavaScript (http://www.sitepoint.com/article/standards-compliant-world/ ) and this, to me at least, seems like a good way foward becuase if degrades nicley and works well in something like the Lynx text browser. As for iFrames then these can easily be recreated in some ways using CSS, or am I missing the point?

So said John Oxton on Wednesday 1 December, 2004 at 11:36PM GMT.

Comment 13

>i still use transitional for ... <a target="_blank"> for certain links...

<a target="_blank"> is the new </blink>

So said robertm on Thursday 2 December, 2004 at 3:21AM GMT.

Comment 14

"It's true that Transitional is just a "cleaned up" HTML 4. Nothing more."

No. XHTML 1.0 Transitional corresponds exactly to HTML 4.01 Transitional. It is not "cleaned up" in any way. The myth that XHTML is somehow mysteriously "stricter" than the corresponding HTML DTD is hard to kill. XHTML 1.0 is *only* a reformulation of HTML 4.01 as an XML application. It doesn't add or remove anything. It even has the same three flavours of DTD as HTML 4.01.

Going from a transitional doctype to a strict doctype, whether it's HTML 4.01 Strict or XHTML 1.0 Strict, is much bigger step forward than changing from one HTML4 doctype to the corresponding XHTML1 doctype. You need to learn to view the markup in a completely different way, namely that it's there to mark up the document structure - not to control how things are rendered on the visitor's monitor.

I fully agree with encouraging people who still haven't done so to learn how to use a strict doctype, but as long as XHTML is practically useless (i.e. until Microsoft goes bankrupt - don't hold your breath) I'd recommend HTML 4.01 Strict. That's the most modern doctype that has a reasonable level of browser support. Even IE6 supports most of it.

So said Tommy Olsson on Thursday 2 December, 2004 at 6:50AM GMT.

Comment 15

Also, some time you must make use of iframes, I know this sucks but on a large site with alot of different enviroments this is the only option. Iframe is not supported in strict but is in transitional. So as long as there is need for iframes, stick with transitional.

So said Jens Wedin on Thursday 2 December, 2004 at 9:04AM GMT.

Comment 16

I have to agree with k - many people choose to use XHTML 1.0 Transitional over Strict because the target attribute of the <a> tag is deprecated. Opening a link in a new window in a valid XHTML Strict document is a bit of an ordeal...

So said Chris Rosser on Thursday 2 December, 2004 at 9:26AM GMT.

Comment 17

If you must disregard usability best practices and force open links in new windows, there is still no need to use a transitional doctype. Like John mentions in comment #12, and as detailed in the article "Accessible Pop-up Links" at A List Apart (http://www.alistapart.com/articles/popuplinks/), you can use JavaScript for this.

So said Roger Johansson on Thursday 2 December, 2004 at 11:55AM GMT.

Comment 18

For all the people out there who open links in new windows, I have disabled this functionality in my browser. If the technique was more widely known (hidden property in Gecko) then I suppose more people would go along. New windows are annoying and break tabbed browsing.

Personally I see absolutely no reason to use XHTML 1.0. As long as you want to be portable, use HTML 4.01. It's actually supported by IE, unlike XHTML, no matter what some people might say. And if you're ready to ditch IE (as I am on my personal site), make the full switch to XHTML 1.1.

So said Sebastian Redl on Thursday 2 December, 2004 at 6:36PM GMT.

Comment 19

Gabriel Mihalache says in comment 8 that "You 'MAY' serve XHTML 1.0 as text/html. You SHOULDN'T server XHTML 1.1 as text/html... that's what the good W3C docs say."

The note actually says that "text/html" MAY only be used with "HTML compatible XHTML". XHTML that is served by "text/html" is NOT XHTML. It is not treated as XHTML. XHTML is supposed to be handled by an XML parser, otherwise it is handled completely differently (as HTML, in fact).

So said Simon Jessey on Thursday 2 December, 2004 at 8:40PM GMT.

Comment 20

The problem with "Accessible Pop-up Links" is that it relies on javascript that runs after the page has fully loaded. If you want to support IE then that seems to happen after all images have loaded. If there is a slow resource and/or a heavily used server the user will have to wait a very long time for the javascript code to execute before they can click the link and have it appear in a new window. I've written a lightweight front end to our email system at the company I work for and I use popups for things like the address book and file attachments. It doesn't make sense to save all the data and go to a new page to select an address book item. It makes it very hard to support multple new memos or replies and keep everything synchronized.

Now don't you believe that I think opening a "normal" link in a new browser window is always appropriate. I used to think that if it was a link to a site outside your domain, you should open a new window, no longer. However, that said there a sometimes appropriate uses of a popup window.

So said Tanny O'Haley on Thursday 2 December, 2004 at 9:29PM GMT.

Comment 21

Re: Sebastian Redl post, yes, opening new windows breaks tabbed browsing. But some webmasters use it for their affiliate links - by opening a new window, users will more likely eventually close the new window and stay on your page, rather than keep browsing on that affiliate page and ignore your page.

So said hbdragon88 on Friday 3 December, 2004 at 3:17AM GMT.

Comment 22

I would go with Simon and the other people using iframes! Try talking to Adtech! A lot of ads on some of the bigger newssites in the world use iframes to show ads (theRegister ;) )
However, there is no reason not to code as strict as possible, and only go transitional when necessary.

So said Claus Jacobsen on Saturday 4 December, 2004 at 10:05AM GMT.

Comment 23

Using STRICT makes IE6 working in a strict mode - so we don't have to deal with, for example, box model bug anymore - it is still present in IE6 quirksmode (which is ON if you use Transitional)

So said BugTomek on Saturday 4 December, 2004 at 1:33PM GMT.

Comment 24

Sorry, that is not true. XHTML Transitional puts IE6 into Standards Mode also (where the box model works properly). Using XHTML Strict instead makes no difference.

So said Chris Hester on Sunday 5 December, 2004 at 12:09AM GMT.

Comment 25

On the topic of MIME Types and XHTML. It seems pretty clear to me. I serve HTML4.01 Strict pages as text/html, if I can't serve (for whatever reason) XHTML pages as application/xhtml+xml.

WaSP Asks the W3C
Serving XHTML with the Right MIME Type
http://www.webstandards.org/learn/askw3c/sep2003.html

So said dean on Thursday 9 December, 2004 at 5:06AM GMT.

Comment 26

XHTML is dumb anyway. I can't tell you the number of sites I see done in XHTML Loose when HTML Strict is so much more preferable.

As XHTML can't be served correctly to all browsers without screwing up the cache nodel, it's pretty much useless. HTML 4.01 Strict is where it's at, and Patrick, your site should be edited to refleect that.

So said Neal on Friday 24 December, 2004 at 4:24AM GMT.

Comment 27

YOU GUYS ARE AWESOME! I've been looking for a nice tutorial to learn XHTML strict, and all tutorials were crappy, they would tell you "write tags in lowercase" and such, and then would use "". It can be very annoying.
But now I found this awesome site! I'm so glad that you guys like to be on the right track like me:) Oh the agony of writing HTML will end soon for me.

So said lupinehunter on Monday 27 December, 2004 at 2:12AM GMT.

Comment 28

I apologize for the empty "" on my last comment. it was supposed to be "<body bgcolor="...">" . Apparently the filter ate it:)

So said lupinehunter on Monday 27 December, 2004 at 2:15AM GMT.

Comment 29

A couple additions for this debate...

First, even though XHTML transitional supports most of the same tags as HTML, XHTML as a whole is a reformulation of HTML as XML, and strict or transitional, that means its XML now and a whole new animal and requires cleaner markup practices so teh xml is supported. That means, all that proprietary Microsoft HTML stuff and other browser stuff will not allow your pages to validate or conform when you move to XHTML, if those elemensts or attributes are not a part of that standard. Transitional just has more "html stuff" it supports, than strict does. But both are a major move, if you are validating your code.

In addition, despite what the w3c recommends, most browsers support the "standard viewing" of web pages sent with html headers (MIME) assigned to either text/html or the XHTML MIME('application/xhtml+xml') for the transitional flavor, though using the xhtml MIME with the doctype means your page is performing correctly as xhtml and so triggers nasty conformance and validation in Mozilla and other conforming agents, and will only show conformance errors till you fix everything (without the MIME you wont see that). This is especially critical for Internet Explorer, as it crashes when sent the correct XHTML MIME ('application/xhtml+xml'), strict or transitional. I have a hack on my site for ASP users that allows you to detect what MIME is supported and send back the xhtml mime if supported. Dont confuse this with the XHTML DOCTYPE or metatag markup content-type, as those only support whats sent as the MIME by the html header. Most the time thats text/html by default by the server, so your pages never truly validate in the browser as true xhtml. The strict flavor does the same thing and very similar, but really does require the xhtml MIME as xhtml. But again, IE 6 will simulate that support when you send it a text/html header, though it wont validate as xhtml in that browser as Mozilla and other agents do. If you send your pages to a Mozilla (conforming agent) with the transitional doctype and then the strict, both using the right xhtml mime header and doctypes, you will see first that both are equally picky and tight with making sure both flavors of xhtml are well-formed and validate as xml documents. The strict flavor will also force you to abandon allot of sloppy html practices, but also has some deprecated attributes that will cause your pages to not work correctly in older agents. Ive seen problems with the loss of the "name" attributes in forms, page anchors (where hashed names are problematic), and of course the target issue in links. I personally think any javascripted fix is a poor choice in "fixing" anything, as its increasingly blocked and turned off by many security features in browsers these days. So, I recommend and I use transitional XHTML for my projects, as the browsers have not matured enough, and the older versions are not "dead" enough to move to the strict flavor without causing some problems for various demographics of online viewers. Strict just deprecates too much critical html "stuff " for my taste right now. As well, most of us in the business world know that there is not enough time in the day or funds to pay a group of uninitiated designers the time required to move complex table-based designs to very strict xhtml structures. Its just not profitable at this point, when one can make the much easier transition to the other flavor of xhtml and still use html thats familiar.

So said Mitchell on Tuesday 28 December, 2004 at 9:31AM GMT.

See Also

^ Top

SiteGround: Fast, reliable, recommended hosting.