HTML or XHTML?
In Spanish/En Español
På Svenska/In Swedish
It seems like the eternal question amongst web developers: HTML or XHTML? Wherever I look there seems to be posts in forums raising the question, web developers asking me or other people write blog posts about what they believe is the right way to go. I’m not writing this post to tell you what the ultimate choice is, but rather to inform you about the consequences of what you choose. So, let’s take it from the top:
Strict or Transitional?
Definitely strict. Transitional doctypes are exactly what the name implies: a doctype for a phase of transition, not meant to be used permanently. If you write HTML and choose Transitional, you will get the Quirks Mode rendering, which results in web browsers just trying to mimic old and incorrect behavior; this means that rendering will be very different from web browser to web browser. If you choose XHTML Transitional, you will get the strict (or rather, strictest) mode available in IE (Note: from version 6) but you will trigger the Almost Standards Mode in Mozilla-based web browsers.
However, if you use a strict doctype, you will get full standards correct rendering and the most consistent and forward compatible interpretation of your pages.
What is XHTML?
A XHTML document is a document that has to be well-formed according to the rules of XML. Every tag has be closed and correctly nested, and for tags like img, input, link etc, a quick close slash should be added at the end of the tag, like this: <input type="text" />. If you’re writing code that should be accessible for people with Netscape 4 and some other web browsers, then make sure to have a space before the slash (Note: not to make it look good in Netscape 4, but to make it work at all).
You’re supposed to be able to save a page written in XHTML and use it as XML right away.
Why XHTML?
It totally depends on your needs. Some people believe it to be very easy and consistent to code in its XML fashion, where everything has to be well-formed and every element has to be closed. Some people choose it to extend its functionality with namespaces, to use it in conjunction with MathML and so on. Other people might work with XHTML, not out of their own choice, but because the products they/their company use deliver XHTML.
I’ve heard something about application/xhtml+xml?
Yes, it’s all about what MIME type goes with your code. For HTML, the media type is text/html. According to W3C, the organization behind many recommendations such as HTML, XHTML etc (albeit mostly known as web standards), state in their XHTML Media Types document:
‘application/xhtml+xml’ SHOULD be used for serving XHTML documents to XHTML user agents. Authors who wish to support both XHTML and HTML user agents MAY utilize content negotiation by serving HTML documents as ‘text/html’ and XHTML documents as ‘application/xhtml+xml’. Also note that it is not necessary for XHTML documents served as ‘application/xhtml+xml’ to follow the HTML Compatibility Guidelines.
What this translates to is that web browsers who can handle application/xhtml+xml should get it served that way. However, IE doesn’t support that media type, thus requiring you send the code as text/html to it, basically resulting in you having to deliver the pages with different media types to different web browsers, using something called content negotiation. By now, you probably think it all sounds like too much of a hassle, and choose to go with text/html all over. I mean, after all, the Appendix C. HTML Compatibility Guidelines presents the validity of serving XHTML as text/html.
However, then you read this:
XHTML documents served as ‘text/html’ will not be processed as XML [XML10], e.g. well-formedness errors may not be detected by user agents. Also be aware that HTML rules will be applied for DOM and style sheets…
Which means that web browsers will not render your pages as XHTML, but rather as HTML and fall back on error handling and trying to guess how it was meant to be. Then you’re most likely back at square one, because you probably don’t want it this way.
Also, something else that is utterly important to know is that certain scripting will not work when sent as application/xhtml+xml. For instance, if you use document.write or have ads on your page through an ad content provider using it (such as Google AdSense), it will stop working. If you implement an AJAX application using the innerHTML property on an element, that won’t work either.
What’s Robert’s opinion?
My personal opinion is that the most important thing is that you choose a strict doctype, be it HTML or XHTML. If you want to use XHTML and serve it as text/html, make sure that you don’t intentionally have code that would break when served as application/xhtml+xml. Do not use scripting like the one above mentioned in an XHTML page, and go the extra mile to make sure it is indeed well-formed. Be also very aware that a page that isn’t well-formed sent as application/xhtml+xml will not render at all, but will instead only display an error message to the end user.
Anne used me as a bat for HTML, but I’d rather be seen as a spokesman for making a thought-through decision, no matter which one it is. I sometimes work with HTML in may daily job and sometimes XHTML, depending on a lot of factors.
So, choose what you think suits your needs best, and choose wisely. And make sure it’s a deliberate decision.
76 Comments/Reactions
November 2nd, 2005 at 23:24
I find it funny that it’s almost always said about XHTML that one have to nest elements correctly. As if HTML permitted incorrect nesting.
November 2nd, 2005 at 23:42
Great summary of everything, in a refreshingly unbiased manner.
November 3rd, 2005 at 3:16
Been thinking I ought to serve my site as XML or rewrite in HTML…
So is there a future for XHTML at all? With ’significant’ members of the web standards movement switching to back to HTML and talking about HTML 5 (plus the draconian XML error handling – euch!) is this the beginning of the end for XHTML, or do you see light at the end of the tunnel?
November 3rd, 2005 at 9:39
David,
Well, Transitional HTML would allow incorrect nesting in that sense that you don’t have to close every tag, you can have start
LIs without ending them etc.But even if HTML wouldn’t allow any incorrect nesting, it’s definitely more crucial for XHTML, that has to be valid XML.
Devon,
Thanks, that’s what I was going for.
Steve,
Ooh, that’s a tough one. I would say that I definitely believe in a future, some way or another, where one can have XHTML that is valid XML.
However, one should really be aware that XHTML 2.0 will not be backwards compatible, so if you choose XHTML all across the line right now, don’t expect it to work forever (or even with upcoming versions of XHTML).
I’m not advising against using XHTML, but if you do, please be aware of all these factors.
November 3rd, 2005 at 10:41
Hmm…
Seems to me it’s time for some friendly myhtbusting
1) Please don’t fall for the myth that Transitional equals Quirks mode! That’s simply not true since it depends on how you write your doctype declaration!
Take another look in “Activating the right layout mode using the doctype declaration“… According to Mr. Sivonen – the
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">Doctype Declaration gets the same treatment as it’s XHTML 1.0 Transitional “counterpart”<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">And frankly – If you make the test you’ll se that Mr Sivonen is correct
2) Please don’t fall for the myth that HTML allows for incorrect nesting of elements!
Don’t confuse element nesting with the effects of the “optional” properties declared for some start- and end-tags for common elements in HTML!
Just because a closing tag is optional doesn’t mean that omitting it make the nesting incorrect!
And PLEASE don’t write “optional tags” up as something that has to do only with HTML4 Transitional since it actually applies to all three HTML4 doctypes! (yeah that’s right – go check the DTD:s )
3)
Don’t confuse the requirements put upon user agents that prohibits them from “choking” on HTML – no matter how incorrectly written – with the markup language HTML itself!
The fact that XHTML compliant browsers are required to “choke” on all errors, and HTML compliant browsers are required to “handle whatever tag soup is flung their way”, has nothing to do with the languages HTML and XHTML
Apart from that, I would like to pitch in another reflection on (X)HTML Strict – It’s actually easier to learn for beginners than the Transitional “flavour” since it contains fewer elements ant attributes
Apart from that – I totally agree with Devon
PEACE
November 3rd, 2005 at 11:13
Jarvklo,
Thank you for your input. Please let me respond:
1) That is true, and there’s a myriad of doctypes out there. I was just simplifying, since most Transitional doctypes do trigger Quirks mode. For more reading about what doctype triggers what mode:
Mozilla’s DOCTYPE sniffing
CSS Enhancements in Internet Explorer 6
2) A matter of words. Nesting may be correct, but it’s not well-formed in the sense of XML. Absolutely true that optional tags do apply to all HTML 4 doctypes.
3) I disagree. Yes, it’s not in the languages themselves that tells the user agents how they should handle the code, but by choosing a language and its corresponding doctype, you will get that result. I don’t think it matters to most web developers if it’s actually XHTML or the MIME type that goes with it that might break rendering in a web browser. What’s important for them to know is that XHTML that isn’t well-formed and sent as
application/xhtml/xmlwill stop rendering and display an error message.Another important thing I didn’t mention in the article is that a strict doctype is a step towards moving all your presentational code into CSS, instead of allowing a number of attributes for visual formatting on every tag.
November 3rd, 2005 at 11:52
Oh I see, now that you no longer care about XHTML, the Case for XHTML is no longer relevant reading for your audience anymore?
November 3rd, 2005 at 12:04
Faruk,
Well, I wanted this post to be informant without making a stand; rather getting people to realize that the choice is up to them and that there’s no single solve-all answer to that.
November 3rd, 2005 at 12:26
Hi Robert,
I completely agree with Devon, a great summary.
Thanks.
Chris
November 3rd, 2005 at 12:57
Chris,
Thank you!
November 3rd, 2005 at 13:15
Good post! I would write something about it, but you come first. Congratulations!
November 3rd, 2005 at 14:23
Ciro,
Thanks, I’m happy to hear that!
November 3rd, 2005 at 14:54
I’m not sure I agree with Faruk’s comment (in his linked article) that using HTML is *against* web standards, unless the W3C are recommending we drop it in favour of XHTML right away? Can’t say I’ve read as much, but I haven’t looked either
I understand that XHTML2 is not compatible, in the same sense that HTML and XHTML are not. But surely, browsers will support the 1.0/1.1 standard for years to come (well beyond current redesign/realignment timescales)? By which time we’ll all be (re)coding sites in XHTML2 anyway… Unless XHTML as it stands is not adopted en masse, and support is dropped… what then? So maybe Faruk has a point after all!
Oh, and given the amount of adsense on Roger’s site these days, I can fully understand his decision to quit XHTML
Is third-party non-compliance the driving factor???
November 3rd, 2005 at 15:12
Steve,
That’s really for Faruk to answer, and maybe on his web site in context.
Most likely, but it will not be such an easy swap from XHTML 1.0 to XHTML 2.0 as people might think.
Maybe HTML 5? Read more in HTML 5 vs. XHTML 2.
Yes, Roger’s got a fair number of ads, doesn’t he?
I can only answer for me, and I would say no about third parties being the driving factor. In my case, using AJAX was one of the driving forces for using HTML on this web site. And really, third-party compliance wouldn’t be a problem if they followed web standards, would it?
November 3rd, 2005 at 18:40
Well – The Transitional doctype recommended in the HTML4 specification nowadays is the one that triggers standards mode…
Which IMHO is sort of important to know if you are about to make an informed descision about wether to “go Transitional” or to “go Strict” in the future regardless of if you choose HTML or XHTML
My point again:
Transitional is in no way automatically equal to Quirks mode – This is a myth that IMHO needs to be smothered in it’s infancy!
Steve – maybe http://w3.org/TR/html/ could be considered to be a subtle a hint in that direction (it delivers the XHTML 1.0 recommendation – not the HTML4 recommendation)
PEACE
November 3rd, 2005 at 18:47
Transitional triggers almost standards mode at best, never standards mode. Search for “How browsers work” or so or read Henri Sivonen his post again.
HTML does not allow incorrect nesting. (What does it mean, actually?) The element nodes that end up in the DOM form a nice tree. Would you convert all element node names to lowercase and put them in the XHTML namespace it would be equivalent to having an XHTML document in the first place, with the exception of the trouble that XHTML brings along.
HTML 5 also has an XML serialization. For example, the new html:canvas element can be used in the XHTML 1 namespace. So can all the Web Forms 2 extensions. Happy coding!
November 3rd, 2005 at 19:46
[...] erstood or even known about XHTML. I definitely recommend you spend five minutes reading it. http://www.robertnyman.com/2005/11/02/html-or-xhtml/
Entry Filed under: Technology, Interweb
Leave a Comment
[...]
November 3rd, 2005 at 20:22
Jarvklo,
Peace!
I do appreciate your concern, but as Anne pointed out and as I wrote in the article, XHTML Transitional only triggers Almost Standards Mode.
Other flavors of Transitional, be it HTML or XHTML, trigger Almost Standards Mode or Quirks mode. So I agree up to 50%: not every Transitional Doctype triggers Quirks Mode, but it never triggers full standards mode either.
And, as mentioned above, it’s important to use a strict doctype to get hints to how content and visual representation should be separated.
For everyone: XHTML: Differences between Strict & Transitional.
Anne,
Thank you for your comment.
Although I’m sure you know what it’s about, I like this quote abot nesting:
Taken from Nesting Tags.
Joshua,
Thank you for the kind words!
November 3rd, 2005 at 20:27
What Jarvklo is referring to I guess is a transitional DTD without referencing the actual DTD. Using only the public identifier. That will trigger quirks mode in most browsers for transitional DOCTYPEs though your document will still validate. (I use that technique in my site for example, only then using a strict identifier which triggers standards mode.)
November 3rd, 2005 at 22:19
Anne
No – Actually what I tried to point out (Don Quixote style
) is that the statement
IMHO is an unfortunate oversimplification since documents using the the “HTML 4.01 Transitional doctype with URI” as far as I can tell from theory and practice gets equal treatment compared to its “XHTML 1 Transitional” counterpart (as long as you leave out the XML prolog and serve the document as text/html
)
’nuff said – I hope
PEACE
November 3rd, 2005 at 22:55
Jarvklo,
I agree and as I stated in my previous comment, there are cases where it results in Quirks Mode rendering and where it results in Almost Standards Mode rendering.
Neither of those options are good, if you ask me. Go strict, today!
November 3rd, 2005 at 23:28
Two corrections:
Firefox 1.5 will support innerHTML in documents served as application/xhtml+xml, as long as the result is still well-formed XML. That doesn’t make it a good idea, but it does work. You’ll still need to use content negotiation for IE, and there are still tons of other Javascript and CSS differences between HTML and XML mode.
Also, you can hack Adsense to use it in application/xhtml+xml documents by moving the Adsense code to a separate (HTML) document and including it into your XHTML document with an object element.
November 4th, 2005 at 2:36
I agree completely with your summary. However…
Warning: nitpicks ahead!
If only that were true
. I think what you mean to say is more accurately phrased as something like “If you use a strict doctype, you’ll get browsers to adhere as closely to the specification as they can”.
That should read: “Every non-empty element has to be explicitly closed and correctly nested, and for empty element types like img, input, link etc, a slash should be added just before the end of the tag…”
November 4th, 2005 at 9:53
Mark,
I’m really happy to see you here!
I didn’t know that about Firefox 1.5 (or, rather forgot about it). But, as you wrote, I don’t think it’s a good idea anyway.
When it comes to Google AdSense and using object elements, I did that on my previous layout here that was also served as
application/xhtml+xml. Good to know for people that want to have XHTML and ads.Jim,
Absolutely true, no web browser is perfect.
Again, true.
That vas some valid nitpicking!
November 4th, 2005 at 11:56
[...]
Jedisthlm.com: Behind the Nordea market information redesign Robert’s talk: HTML or XHTML? BrainFuel: Javascript Libraries (AJAX For Dummies) Mozilla Kicks Off ” [...]
November 4th, 2005 at 17:03
Having developed in HTML tag soup, tables for layout, and forms on one hand, and valid XHTML 1.1+CSS+WCAG on the other, I have to agree with the conclusion, and here are some lessons learned:
- It’s easier to make XHTML look good, as long as you keep an eye on those browser bugs and support levels.
- Marking up semantically really does help. Avoid divitis and classitis!
- I’d argue that making sure the code is valid is more important than whether you use XHTML or HTML.
- That is, unless you want to use XSLT to separate content from functionality, which is a very nice idea (do you like closing HTML tags inside PHP?)
November 4th, 2005 at 19:54
l0b0,
I’m glad that you agree!
The lessons you’ve learned are really valuable, and in my opinion, the most important ones when developing web interfaces.
And XSLT rocks…
November 5th, 2005 at 5:30
[...] 3:32 pm Robert Nyman has a good post up called HTML Or XHTML? [...]
November 5th, 2005 at 11:11
You wrote:
“If you choose XHTML TRANSATIONAL, you will get the strict (or rather, strictest) mode available in IE..”
Is not ?:
“If you choose XHTML Strict, you will get the strict (or rather, strictest) mode available in IE..”
nice article.
congratulations.
November 5th, 2005 at 12:32
Carlos,
Thanks!
It actually isn’t a typo. IE only implements two rendering modes: Quirks Mode and Strict Mode (although Strict Mode in IE isn’t really strict, since when in that mode it still doesn’t support very basic CSS 2, amongst other things).
As mentioned in the example in the article, this is opposed to Mozilla web browsers that suppost three modes: Quirks Mode, Almost Standards Mode and Full Standards Mode.
November 5th, 2005 at 14:42
Hi
I still don’t get exactly why you use html instead of xhtml?
The same result is achieved by using xhtml 1.0 transitional, which doesn’t have to be served with application/xhtml+xml…
Sending the correct mime type depending on browser can be done by checking the HTTP_ACCEPT header, sent to the server every request.
Furthermore, as previous posters have pointed out, you can use the object element for google’s advertisements. About the asynchronous javascripting – this part is easily programmed to conform with standards – just return xml from your server-script, and then use the DOM methods to change the document in the viewport.
Henke
November 5th, 2005 at 14:49
Btw… Tell me if you want a script that changes content within xml nodes, or a link to some code changing the mime-type depending on http_accept.
November 6th, 2005 at 2:36
[...]
The Question
Posted in writing by Jim Mangan on the November 6th, 2005
Robert’talk, HTML or XHTML: It seems like the eternal question amongst web [...]
November 6th, 2005 at 13:47
Henrik,
As stated above, for a number of reasons, I really don’t recommend using the Transitional doctype. Those doctypes are mostly around for allowing old things to be valid; attributes and such that are really meant to be deprecated.
Then, according to the Appendix C. HTML Compatibility Guidelines, XHTML 1.0 Strict is also allowed to be sent as as
text/html, so it doesn’t have to be Transitional to be ok.All the approaches you mention are valid and they are ways to accomplish it; I’m not saying it’s impossible. But from my point of view, the purpose of XHTML is to be the HTML equivalent of XHTML. Why would I then use things that would break when sent properly as
application/xhtml+xml?On top of that, I would have to use content negotiation to serve HTML to some web browsers as
text/html, and XHTML to some web browsers asapplication/xhtml/xml; to haveobjectelements for some web browsers and thedocument.writeJavaScript for others.I don’t know if you were around then, but for the first five months or so, this web page was doing exactly that. But the three main reasons I switched to HTML were:
1) To much of a hassle to have different versions, and not very suitable to have different web browser-specific code.
2) As mentioned above, If I use XHTML, my opinion is that it should work when sent as
application/xhtml/xml.3 I see no gain whatsoever in using XHTML for this specific web site.
So, thanks for the offers for script and code, but I’ve been doing that myself for quite some time, so I know how to do it. However, if you have some personal favorite links that you want to share with the other readers here, feel free to post a comment with those links.
November 7th, 2005 at 10:20
[...]
Visitors through the roof!
[...]
November 7th, 2005 at 17:34
Hmmm….I was not aware that “transitional” was still ‘quirksmode’ in the browsers.
I tend to disagree, don’t use any doctype at all and you’ll see “quirksmode”, the botched box-model by IE6.
I spent 2 days banging my head against a wall, until I discovered I needed a doctype. html 4.01 transitional fixed all the bugs and issues I was having. Never heard it as still being quirksmode though until I read this.
November 7th, 2005 at 18:39
Great article! Really mind-blowing stuff. Going to have think about this.
November 7th, 2005 at 20:46
Anthony,
As mentioned above, different doctypes can trigger different rendering strictness, although never full standards mode. Going for a strict doctype is a way of ensuring the most correct rendering while also helping you focus more on putting the presentational code in CSS (since it doesn’t allow much visual formatting in the HTML/XHTML).
Also, I’m glad to hear that you’ve stopped banging your head on the wall now…
MÃ¥rten,
Thank you!
November 10th, 2005 at 1:23
And Robert’s opinion, is it avaliable either in View -> Page Source (when reading this post) ??
November 10th, 2005 at 9:18
Dudu,
Well, sometimes that’s true and sometimes it isn’t. That’s the point here: there’s no single correct answer, everyone need to choose what’s most suitable for them depending on the factors mentioned in the article.
November 10th, 2005 at 14:36
[...] n automate almost everything from disk operations to internet (tags: macro software) Robert’s talk » HTML or XHTML? It seems like the eternal question amongst web developers [...]
November 13th, 2005 at 11:38
Hej Robert
I can understand your viewpoint – if you don’t need the power of xml, then feel free to use html instead. Personally I use application/xhtml+xml because sometimes I need to use MathML, and for the feeling that you’re actually using the latest technology.
Using the object element – does that necessarily break xml compliance? As far as I know it doesn’t.
“But from my point of view, the purpose of XHTML is to be the HTML equivalent of XHTML.” – do you mean “…the html equivalent of XML”?
About point number one – web browser specific code – the most basic content negotiation would make you write the correct MIME type of the sent document depending on the http_accept of the client browser, but I don’t see how this translates into browser specific – it’s more on/off if a browser accepts the xml mime type or not…
About the document.write – no browser specific solution is needed – the DOM tree can be manipulated in IE as well…
“3) I see no gain whatsoever in using XHTML for this specific web site.” – fair point…
November 13th, 2005 at 21:17
Henrik,
Depends on what you want to use it for. It isn’t supported properly in IE for all its different kinds of usage.
Well, yes, the most basic one. But it’s inevitable that other issues or things you will use show up.
When it comes to
document.writeas opposed to manipulating the DOM, of course I’d always go for the DOM approach. But what I’m talking about here is third party content that you can’t control, such as ads from Google, that usesdocument.writeto display the ads.November 21st, 2005 at 1:34
[...] s diferencias entre ambos estándares y comenta algunos detalles generales en su artÃÂculo HTML or XHTML?; un buen punto de partida para los que estén en la duda. [...]
December 12th, 2005 at 1:54
[...] HTML ou XHTML? Pois é… Eu ia escrever algo, mas o cara chegou primeiro! HTML or XHTML? por Robert Nyman. Ele fala sobre perguntas como: Usar HTML ou XHTML? Usar [...]
April 13th, 2006 at 15:53
[...] geben werden z.B. Leere ElementeLeer Elemente müssen geschlossen werden z.B. Weblinks HTML or XHTML? http://de.wikipedia.org/wiki/Xhtml http://jendryschik.de/wsdev/einfuehrung/x [...]
July 15th, 2006 at 0:53
[...] sionante para IllUstrator: Scriptographer
�HTML o XHTML?
Versión original del artículo por Robert Nyman [...]
September 27th, 2006 at 20:09
[...] or a long time – and it’s commonly opined that the most important choice is actually between strict and transitional doctypes. Recently, this topic has experienced a bit of a [...]
October 11th, 2006 at 1:25
In Internet there are two languages HTML and sound replace XHTML.
We ask what is needed use?
How to be in standard W3C ?
Here is re-think of it:
http://www.gajdaw.pl/html/html-czy-xhtml.html
Me personally I use what I love it is XHTML.
October 18th, 2006 at 13:56
[...] tood or even known about XHTML. I definitely recommend you spend five minutes reading it. The Article
[...]
November 22nd, 2006 at 21:43
So… what do you need to use if you need to use axaj libraries as prototype and scriptacolous and also use google ads ?
Can’t quite figure it out ….
November 22nd, 2006 at 21:54
George,
Basically, you can use either. But if serve it with the correct MIME type,
application/xhtml+XML, things likeinnerHTML(except for in Firefox) anddocument.writewon’t work.Therefore, to make Google ads work, you need to mkae a workaround. Read more in Why won’t AdSense work with true XHTML?.
December 2nd, 2006 at 7:47
[...] gsmogelijkheden. De keuze tussen HTML en XHTML komt dus eigenlijk neer op een persoonlijke voorkeur. Conclusie Van de talloze doctypes die je kunt vinden op interne [...]
December 16th, 2006 at 17:41
[...] xhtml oder html? Filed under: CSS&xHTML, Blackspace — Finkregh @ 8:10 pm http://www.robertnyman.com/2005/11/02/html-or-xhtml/ denn Die Syntax von HTML ist komplizie [...]
January 21st, 2007 at 2:27
@Robert
Referencing Dutch sites? Robert, where you’re from? Nice summary btw.
@all
Why does an informational page gets turned into some discussion about what’s best? If you like HTML more, that’s the way to go for you. And alike for XHTML.
Admitted, XHTML has some gotcha’s, but reading all the above points ‘em out nicely. And HTML allowing dodgy tag closing, doesn’t mean you’ve GOT to do that
.
In the end, it all comes down to what one likes best. But be honest, the differences in page rendering when using HTML is areason on it’s own to go XHTML. If it’s only to not drive yourself crazy when trying to achieve a consistent cross-browser rendering
.
Personally, I go for strict mode rendering with XHTML, served as xhtml/text. To make sure pages are well-formed, I use the W3C validator. No content negotiating, clean code, (near) consistent rendering and no old-skool stuff.
As for XHTML 2.0 and HTML 5: don’t hold your breath guys. Those are in the making for years now and they won’t be used in ages to come. When was XHTML 1.0 released? 1998 or so? And still a minority of websites makes use of it.
January 22nd, 2007 at 8:54
Stefan,
I’m Swedish!
To my knowledge, using a strict HTML and XHTML DOCTYPE gives the same result in all web browsers. If you know of any exception, please let me know.
February 21st, 2007 at 18:24
[...] ody would prefer the good old html over the all-so-hyped xhtml, read a little bit about it here. — Felix Geisendörfer aka the_undefined Related Posts [...]
April 21st, 2007 at 21:55
[...] oder Transitional? Diese Frage stellt sich mir viel eher als das ständige HTML vs. XHTML, wie hier, hier oder auch hier. [...]
June 9th, 2007 at 11:08
[...] door sommigen betwijfeld. Misschien doet XHTML alleen maar kwaad? Of maakt het eigenljk niet uit of je HTML of XHTML gebruikt? Een aantal guru’s van het eerste moment heeft inmiddels de switch terug naar HTML 4 [...]
September 19th, 2007 at 20:55
really both (XHTML HTML)are the web base today
December 1st, 2007 at 12:45
Hiya,
I’m making a website as part of my Personal Project for MYP (Middle Years Programme) which is part of the IBO.
I’m having troubles with the compatibility in different web browsers.
I have Dreamweaver but I’m not sure what to use; my options are…
HTML 4.01 Transitional
HTML 4.01 Strict
XHTML 1.0 Transitional
XHTML 1.0 Strict
XHTML 1.1
XHTML Mobile 1.0
any ideas to help me please?
December 2nd, 2007 at 23:28
Nathalie,
It depends on that what kind of web site it is for, but I would suggest that you would go with a strict Dotype. Also, I’d strongly recommend you to handcode and not use a WYSIWYG tool for building a web site, to learn the ins and outs of HTML. I’d say it’s essential to learn the basics and at the same time get a 100% control of the code itself.
May 7th, 2008 at 17:01
I also still don’t know why you would use html as opposed to xhtml, the features are relatively the same.
May 21st, 2008 at 16:12
I have a problem migrating ASP.NET1.1 code to ASP.NET2.0.
i have just copied all the .aspx files to 2.0 and have to remove the in 2.0 other wise it wont support 1.1 code.
Now the problem is some of the 2.0 controls are not functioning properly as the required DOCTYPE is not present.
what to do for making my web app compatible to both 1.1 and 2.0 controls
May 21st, 2008 at 16:13
I have a problem migrating ASP.NET1.1 code to ASP.NET2.0.
i have just copied all the .aspx files to 2.0 and have to remove DOCTYPE in 2.0 other wise it wont support 1.1 code.
Now the problem is some of the 2.0 controls are not functioning properly as the required DOCTYPE is not present.
what to do for making my web app compatible to both 1.1 and 2.0 controls
May 25th, 2008 at 11:58
I dont know weather there is any solution for my problem!
June 25th, 2008 at 2:30
I would prefer Html 4.0 for small websites and XHTML for more adavnced websites, Though there are still a large number of popular websites on the web using HTML 4.0
June 25th, 2008 at 2:35
I think XHTML will strict you to code the website more neat and tidy.
August 28th, 2008 at 17:27
[...] HTML or XHTML [...]
October 23rd, 2008 at 17:05
Hi Robert, last time i visited here its was the old site. Same interest of web standards and XHTML strict only i guess. I have been practising XHTML strict since i find it so easy to already prepare the site with functionaloty to PHP programmers and it actually saves time and development. The CSS makes everything so easy to globally change and edit funtions and layout issues.
I love this XHTML technology and i dont believe that HTML5 will be a step up but the XHTML 2 might have even better but more cut tags as i have seen in the examples…
Time till show if XHTML or HTML will be the flagship in the web development future. As i understand its only some 10% or us front-end developers that actually practice web standards with validation options. I think this is the future and its very important also to make websites for more different platform layouts and browsers…
Cheerio…
Michael Persson
December 9th, 2008 at 16:27
[...] being very little understand what is HTML, XHTML is a blank canvas for me.  There is blog by Robert Nyman offers good articles regarding this subject which sugested that choosing HTML or XHTML is depending [...]
December 9th, 2008 at 17:15
[...] http://www.robertnyman.com/2005/11/02/html-or-xhtml/ [...]
April 21st, 2009 at 8:18
[...] Robert Nyman machte zwischenzeitlich mal einen kurzen Ausbruchsversuch, bekam dafür auch viele, viele, kleine Jehova-Steinchen an den Kopf. Doch mittlerweile ist der Hype ziemlich abgeklungen und man hört derweil schon eine Menge von HTML5. Jeremy Keith macht UXLondon in HTML5. Ein grossartiges Gebilde, das mehr ist als ein Showcase. Gerade heute ging FullFrontal ebenfalls mit HTML5-Doctype online. [...]
August 8th, 2009 at 2:28
[...] Versión original del artículo por Robert Nyman (autorizado por él mismo vía e-mail) [...]
September 28th, 2009 at 9:54
[...] It’s mostly about rendering mode, and in my mind you should always go for strict. Read more at Transitional vs. Strict Markup by RJ, and I also scratch the surface in my post HTML or XHTML?. [...]
February 25th, 2010 at 4:12
Hi guys,
I know this might be a bit off topic but seeing that a bunch of you own websites, where would the best place be to host. Someone recommended I use Blue Host for $6.95 a month which seems like a great deal. Anyone here on robertnyman.com using them?
Write a comment
Twitter reactions