The case for XHTML
Subject level: Advanced
Some people say XHTML on the web has failed, but I say it is our biggest success in the fight for Web Standards.
There is a myth going round in the world (both on- and offline) that says: XHTML is hot and modern, fast and efficient, flexible and userfriendly
; and some of my friends use this myth to plead their case against XHTML.
XHTML is a good thing for the web, though, and it's a shame that people are trying to make a case against it. To prove this, I'll flesh out the myth for you and then show you why XHTML is the best thing since sliced bread, when it comes to our fight for Web Standards.
- Hot and Modern
- Fact of the matter is, XHTML simply is hot, and virtually every company that has heard of Web Standards but has no real knowledge of the Internet considers an XHTML-website to be the hot modern thing to have.
- Fast
- This is more tricky. If, and that is a big if, you have a valid XHTML document sent as
application/xhtml+xml, then complying browsers (pretty much anything that isn't Internet Explorer) will be able to render the page much faster. When you send it astext/htmlhowever, there is no implicit speed advantage whatsoever. - Efficient
- As for the efficiency, it's very subjective all around. Some people look at efficiency in bytecounts, and if you then compare XHTML to HTML you can clearly see that XHTML requires more bandwidth. Others look at how fast one writes a simple XHTML document versus an HTML document, and measure their own typing speed rather than anything else. Overall, XHTML has no implicit efficiency-advantage over HTML: it depends greatly on how you write your pages. That part of the myth holds true, indeed.
- Flexible
- Flexibility is, of course, a fairly vague concept. What may be flexible to one can be far from it to another. However, most people, when confronted with XHTML and Web Standards, see sites like the CSS Zen Garden and mistakenly assume that the flexibility of a table-less design with CSS for the layout is the flexibility of XHTML. That part of the myth holds true, as well.
- Userfriendly
- Userfriendliness has absolutely nothing to do with XHTML or HTML, it's a design aspect and thus has more to do with CSS than anything else. Obviously, this part of the myth holds true as well.
So what have we learned? Most of the myth of XHTML holds true. But then here's my question: so what?
Plenty of people are saying we shouldn't use XHTML on the web, unless you're a certain mathematician (read: have real functional uses for XHTML). This is where the case for XHTML comes into play. XHTML on the web is good, real good, and I'll tell you why.
Anne showed us in February of this year that XHTML is much more strict than HTML. I would even say, HTML isn't strict at all. His example is an excellent display of the looseness of HTML, the looseness that translates into unreliability. For what?
you wonder. Well, the new wave of course.
I'm willing to bet that almost 90% of all people currently in the webdevelopment sector, on international level, have started out with their HTML'ing skills by looking at the source of pages and copying the (X)HTML for their own needs. One of the biggest problems is that people copy from poor sources; pages made with Frontpage or other such horrible clients. This is hard to avoid, because 99% of the web is a poor source. But lo and behold, the answer to our prayers came to us, the answer being Web Standards, its form being… XHTML!
Why XHTML kicks HTML's ass
We, as cognizant webdevelopers of today's Internet, have a certain responsibility. We speak of Standards, we speak of separation of structure and presentation, we speak of CSS-layouts instead of tables… but so far, we seem to forget how our audience works: by use of examples.
I believe that XHTML is our future. Perhaps not the long-term future that the Web of 2015 will be built on, but the future of Web Standards themselves. We're fighting the cause of Web Standards, and XHTML is our weapon.
Sure, we should inform companies of the benefits of Standards themselves, rather than the benefits of XHTML. But it is XHTML that will boost our cause. Most companies that are becoming aware of the changing situation on the web are calling for their sites to become XHTML. It may be a myth that XHTML will solve all those problems
that we see in old websites, but whether or not it is a myth is completely irrelevant: XHTML is what is getting companies to become aware of Web Standards. Not HTML.
I can't stress that point enough: companies are becoming aware of our fight for Standards thanks to the existance of XHTML. If you think otherwise, you've clearly not had many companies ask you to build their website in a new and modern way: XHTML is one of their first demands.
So what message are we giving out by saying we shouldn't use XHTML? Exactly, that Standards aren't good. Any webdeveloper who's even just remotely up to date with the current web will say that's nonsense! absolute bullocks!
- and they're right. But we shouldn't be trying to convince ourselves, we should be trying to convince the rest of the world (for a change)!
Telling a customer that their demand for XHTML is foolish (but then using terms you can say to a customer, of course) will cause more harm to our fight for Standards than anything else. The customer will think you're trying to convince them that modern webbuilding isn't a good thing, maybe because you're used to using Frontpage (the customer doesn't know, they'll fill in these blanks on their own!), maybe because you find it too costly to build according to Web Standards, maybe something else. But under no circumstances will a customer, who has no interest in the details of Web Standards and therefore never investigate on the matter, think that you're merely saying that XHTML isn't right and that HTML is better. Isn't HTML that outdated thing that people keep warning about all the time? Like, my neighbor says HTML is bad because it's "so 1996".
That's how the companies will respond to you if you push HTML instead of XHTML.
text/html 101
So seriously, what's the big deal with an XHTML document being sent as text/html, when you do it on a customer site? Yes, I know that the official specification says it should be application/xhtml+xml, the specification also says that for backwards compatibility we're allowed to send it as text/html though. Yes, I know that XHTML sent as text/html will be parsed as "tag soup" (*groan*) by Internet Explorer… but did anyone realize that Internet Explorer will treat it as tag soup either way? Okay, okay, if you do everything completely by the book, you can get IE to work in Standards mode - but IE's Standards mode is far from Standards compliant, so why should we care? Weren't we working in favor of Standards, here? Hello! Using XHTML is in favor of Web Standards, using HTML is against! Let me back up that statement with some examples.
HTML is not strict, and thus unreliable material to be used as an example. The more we spread HTML out there, the more people who are -just- getting into this world will think HTML is fine. They'll discover that certain tags, like </li>, can be omitted. They'll stop using those tags and proceed to give an even worse example to the people that look at their source.
Now imagine doing that with XHTML. Your pages won't validate if you omit such tags; people looking at your source will copy it, and if they ever accidentally forgot a closing li tag, their page won't validate. They'll correct the problem and other people looking at their source will still have a good example in front of them to learn from. All in all, the Web is slowly becoming a stricter place, and that is what we ultimately need to achieve, if we wish to have Web Standards become truly successful.
Admittedly, this whole example is of much less value when people write XHTML pages that don't validate. But even then, an XHTML page can be better than an HTML page.
Additionally, it should be noted that Web Standards-aware people should really just work with something that ensures valid XHTML and simply send it as application/xhtml+xml - such as this site right here. No such tools yet? Create them! Or urge the creators of your tool to focus on ensuring valid XHTML. There are excellent modules that you can incorporate, if you care enough to ensure valid XHTML, and really, people creating blogs like Movable Type or Wordpress should most definitely care enough.
On the current web, however, there is no serious downside to using XHTML with a text/html MIME-type. Sure, some people proclaim that it is harmful - but the situation of 2 years ago is not the situation of today. Additionally, that document on XHTML contradicts itself. It says using XHTML is considered harmful, then proceeds to say that there are no cases where it causes actual harm. It makes things more difficult if you're used to a certain behaviour, true enough, but that's not harmful.
However, there are two little parts from Ian Hickson's document that I want to carefully address:
The only real advantage to using XHTML rather than HTML4 is that it is then possible to use XML tools with it.
With HTML being counter-productive to our fight for Web Standards - and XHTML being extremely productive - there is a much bigger advantage to using XHTML. The advantage is that XHTML makes companies worldwide become aware of Web Standards. HTML has severely failed to do so and continues to fail by not being strict enough to be of any use to us.
Also note that I would personally suggest that even advanced authors not use XHTML sent as text/html, since many authors copy and paste markup from others and thus may easily end up copying the valid XHTML markup but using it as HTML4.
This is definitely a 2002-statement, as I don't see that happen much at all anymore on the web of today. Rather, people copy source and validate as XHTML, and if they mis-copy (or copy from an invalid page) they'll realize they did something wrong, because the Validator will tell them they did something wrong. With the debate on XHTML and Web Standards being so incredibly prominent everywhere you go when you look for webdevelopment-related information, we should stick to giving a good example by giving them good XHTML to learn from.
So to conclude, sending XHTML as text/html causes no damage or harm anywhere today, as long as your XHTML does validate. And if you want Web Standards to become more and more wide-spread, stick to using XHTML and validate your pages.
Bookmark:
Newsvine
del.icio.us
Digg
Subscribe: atom, rss, ..what are feeds?
- Top Articles
- The case for XHTML
- SQL Naming Convention
- 10 Questions for Clear: left
- Newsvine: the organic web, organized
- The dangers of a new Web
- @media 2005: Jeffrey Zeldman
- Identifying classy semantics
- @media 2005: Douglas Bowman
- Web Standards and the Educations
- @media 2005: Robin Christopherson
- Recent Articles
- Web Standards and the Educations
- Newsvine: the organic web, organized
- 10 Questions for Clear: left
- The dangers of a new Web
- Identifying classy semantics
- @media 2005: Douglas Bowman
- @media 2005: Robin Christopherson
- @media 2005: Joe Clark
- @media 2005: Jeffrey Zeldman
- The case for XHTML
FlickrFire
All times are in CET. It is now 19:44.
