Forum Moderators: open

Message Too Old, No Replies

Why most of us should NOT use XHTML

         

DrDoc

7:39 pm on Apr 1, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Ian Hickson, a member of the Mozilla.org Browser Standards Compliance QA team and an invited expert in the W3C CSS Working Group, explains why XHTML should not be sent as text/html: [hixie.ch...]

2by4

9:11 pm on Apr 4, 2006 (gmt 0)

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



mattur:
The adoption of XHTML to date is imho characterised by an element of foolishness. It's snobby and condescending to say so, but there's no other way to say it: many people invested time and effort in XHTML for no apparent reason. They did so because they were told to by self-appointed "experts" (or perhaps more accurately: famous, light-weight fools ;)).

As usual, you hit the nail on the head. I've done real xhtml strict sites, with header checking and all that nonsense, I've even fixed the javascript document.write issues on one site. The only reason to do that I can see is to show that I can do that.

I did along the way find a use for serving real xhtml pages with accept header checking, it's actually pretty slick, when you build a site or new page, you can run it through firefox or opera and get a line error number on each error in the html or content.

Commercially I've pretty much given up on xhtml. If I will be the only person ever working on the site I'll use xhtml 1.0 transitional once in a while. But if anyone else will touch the code, it's going to be 4.01 strict or loose, nothing is more stupid that serving error filled xhtml, that completely defeats the entire purpose of using xhtml.

Objectively, xhtml violated every single promise of html, which is and was a beautifully flexible and forgiving markup language. The browsers handled it fine, the error engines were perfected years ago, anyone who wants to can put up the most absurdly convoluted code in the world and still expect to see it render more or less correctly.

I think one of the biggest sources of confusion in the early pro-xhtml days, 2000-2002, was confusing full css with xhtml. Likewise with css/p. How these things came to be linked in younger developer's minds was never clear to me, since there is nothing in xhtml that you can't do in html with css, realistically speaking anyway.

If you look at what really happened with html, it was developed very organically, innovations flowed into it from the market, and it spread like wildfire. It was only when the w3c decided to try to take back control that xhtml was really born. So what do we have now? A totally useless specification, and a frozen feature set in html 4. Not to mention that xhtml 1.0 offers less, not more, control and features.

I remember the first time I took a look at the xhtml 2.0 proposals, I immediately knew that I would never use it, it was so ridiculous it was hard to understand how something so utterly clueless could ever have been put forward, user friendliness was totally thrown out the door in favor of some pointless 'code purity' of interest to few humans on the planet.

Another confusion came from the idea that data itself would sit in xhtml pages, and so of course those pages had to have strict data layout. As if the world wide web would actually be built up out of static flat files. It should be obvious to even the most cluess person out there today that what has in fact happened is that html has become what it was supposed to be, a markup language used to mark up the output of dynamic database driven systems.

blogs, wikis, forums, cms systems, that is. It's totally irrelevant how you output that data, xhtml, html, whatever you want to do, just tweak the template and that's it. So why use something that is harder to work with, less tolerant of errors, etc?

The elimination of document.write as an option was I think the single most stupid thing in that proposal. I spent a few months playing around with the options, which massively violated the principle of KISS [keep it simple stupid].

The new html should have been more flexible, not less, it should have offered developers more options and tags, not fewer, it should have been even more forgiving of error, not less. It should have had new form elements, and so on. And it should have been easier to use, not less.

While I don't regret having spent the time to really look into all the practical xhtmls, as a learning experience it was and is useful, I just don't see any real point to all that effort.

Anyway, as we can see from this thread, common sense has returned to the topic, which is a relief to see.

Will I keep using xhtml on my own stuff? Yes, but only because I like the rigour of it, that's a personal thing, it has no real meaning, it's just liking clean consistent code. Any xhtml site I do can be changed to html 4 strict with 2 sitewide search and replaces, or template modifications, ' />' -> '>' and the doctype stuff.

Same to convert a html 4.01 strict to xhtml, a few regular expression search and replaces takes care of it.

Also keep in mind, for the times that data actually would be stored in flat files of some type, those would be xml, which would then be transformed by something like xsl or whatever into whatever markup language you wanted.

jpalmer

6:05 am on Apr 13, 2006 (gmt 0)

10+ Year Member



Yaay, is all I can say.

As primarily a content creator using the web as a vehicle to distribute this content, the proprietary tag soup was problematic to me, which I hoped web standard XHTML/CSS was going to take care of. But getting my head around it after so many years of tables with Wilbur ....

I have 3 "guru" tomes on my bookshelf on web standards/XHTML/CSS, for teaching myself the blasted stuff, and every one of them uses different unit types/methods for the same function, for example - font size display.

So I now am comfortable with idea that I set my standard and use it consistently. As long as it's well formed, validates and doesn't break in 90% of my user base.

Well, that's my rule and I'm sticking to it. ;)

All hail 4.x HTML Baby!

(OT: I see HTML 5.x is in the wind. Can we all just stop for a while, so everyone can catch up?)

rhianna

7:43 pm on Apr 13, 2006 (gmt 0)

10+ Year Member



DrDoc, I just read this thread and Ian Hickson's paper.
I am confused because I also read your endorsement of XHTML [webmasterworld.com] back in 2002 where you enthusiastically said:
So, is it worth it? Definitely! The pages are smaller in size, they load faster, and they still don't look too crappy in older browsers (and they look better in newer ones!). It is also way easier to update them and avoid nesting errors.

There is quite a contrast between the thread containing the above quote with the current thread.
A main point from the current topic in this thread is that pages can break in XHTML (browser wars again) and that some webmasters who do not understand the underlying principles should avoid XHTML.

I use Dreamweaver MX to create my pages.
I'm good at writing original content but I've noticed that some sections of my sites don't appear consistently as intended across various browsers.
Some of my html pages need to be updated to a DHTML standard; some of my pages are made with CSS but are not uniformly standard to give the site a "total look"; and then some of my content needs to be extracted and put into a new format altogether. I thought I would create some designs with XHTML to create a standard and pulled together look.

I have a book published by SYBEX, Mastering XHTML.
The book was written in 2001.

I'm in the process of creating a few master designs with XHTML for my sites but now this thread has alerted me to the potentional problem that my XHTML sites might break in browsers (IE, Safari)?

I plan to "go by the book" so is it okay for me to start my pages with:

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
etc...

or should I use

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

Thank you :)

encyclo

6:01 pm on Apr 14, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld rhianna! Unfortunately it appears your book is rather out of date - in fact much of this thread is about the experience gained over the last few years which is questioning earlier assumptions given as examples in books and on the web.

I would recommend the HTML 4.01 Transitional route of the two you've mentioned, for two reasons. The first is that, as this thread has discussed, using XHTML correctly is much harder than simply swapping the doctype - and there are precious few advantages to moving to XHTML anyway.

The second reason is that the example syntax you gave has an XML prolog before the doctype, which has for effect to switch IE6 into "quirks mode", making cross-browser rendering much more complicated. See Quirks Mode vs. Standards Mode [webmasterworld.com] for more information. The HTML 4.01 doctype you mention ensures standards-compliance mode across all modern browsers.

rhianna

7:08 pm on Apr 14, 2006 (gmt 0)

10+ Year Member



Thanks for your reply, encyclo.
I get confused because I thought XHTML was part of the new Web2.0 standard.

My big problem is getting my sites to appear the same and do the same across all browsers :(

Is there a new Web2.0 standard?

kaled

10:02 am on Apr 15, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



My understanding of "Web 2.0" (though I may be wrong) is that it is simply a term being bandied about by nerds geeks and marketeers for a collection of technologies.

Kaled.

spyder_tek

6:42 am on Apr 18, 2006 (gmt 0)

10+ Year Member



So, if my pages use the XHTML strict doctype declaration, should I switch over to HTML 4.01 strict?

2by4

7:34 am on Apr 18, 2006 (gmt 0)

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



It's your decision, if you are serving xhtml 1.0 strict as mimetype text/html, then it's not really correct, it's just tag soup html for most browsers out there.

If they do not validate as zero error then there is zero reason to call them xhtml.

You should have the quality of your code match the doctype, if your xhtml has many errors, then there is literally no reason to be using that.

graeme_p

9:12 am on Apr 18, 2006 (gmt 0)

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



if you are serving xhtml 1.0 strict as mimetype text/html, then it's not really correct, it's just tag soup html for most browsers out there.

What about xhtml transitional as text/html? I was under the impression that is OK. If I am wrong please correct me.

knighty

3:44 pm on Apr 18, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member




Yes - using XHTML transitional and serving it as text is fine, dont get drawn into the panic of going back to HTML 4.
This 75 message thread spans 8 pages: 75