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.

 

Related reading

76 Comments

  • 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.

  • Devon says:

    Great summary of everything, in a refreshingly unbiased manner.

  • 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?

  • Robert Nyman says:

    David,

    Well, Transitional HTML would allow incorrect nesting in that sense that you don't have to close every tag, you can have start <code>LI</code>s 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.

  • Jarvklo says:

    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 <code><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"></code&gt; Doctype Declaration gets the same treatment as it's XHTML 1.0 Transitional "counterpart" <code><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"></code&gt;

    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 🙂

  • Robert Nyman says:

    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 <code>application/xhtml/xml</code> will 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.

  • Oh I see, now that you no longer care about XHTML, the Case for XHTML is no longer relevant reading for your audience anymore? 😛

  • Robert Nyman says:

    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. 🙂

  • Chris says:

    Hi Robert,

    I completely agree with Devon, a great summary.

    Thanks.

    Chris

  • Robert Nyman says:

    Chris,

    Thank you!

  • Ciro Feitosa says:

    Good post! I would write something about it, but you come first. Congratulations! 😉

  • Robert Nyman says:

    Ciro,

    Thanks, I'm happy to hear that! 🙂

  • 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???

  • Robert Nyman says:

    Steve,

    That's really for Faruk to answer, and maybe on his web site in context.

    …browsers will support the 1.0/1.1 standard for years to come (well beyond current redesign/realignment timescales)?

    Most likely, but it will not be such an easy swap from XHTML 1.0 to XHTML 2.0 as people might think.

    Unless XHTML as it stands is not adopted en masse, and support is dropped… what then?

    Maybe HTML 5? Read more in HTML 5 vs. XHTML 2.

    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???

    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?

  • […] 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

    […]

  • Jarvklo says:

    I was just simplifying, since most Transitional doctypes do trigger Quirks mode.

    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!

    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

    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 🙂

  • 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!

  • Robert Nyman says:

    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:

    HTML tags should be "nested" in a proper order, meaning that the tag opened most recently is always the next tag to close.

    Taken from Nesting Tags.

    Joshua,

    Thank you for the kind words!

  • 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.)

  • Mark says:

    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.

  • Jarvklo says:

    Anne

    No – Actually what I tried to point out (Don Quixote style 🙂 ) is that the statement

    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.

    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 🙂

  • Robert Nyman says:

    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! 🙂

  • Jim says:

    I agree completely with your summary. However…

    Warning: nitpicks ahead!

    However, if you use a strict doctype, you will get full standards correct rendering

    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".

    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" />.

    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…"

  • Robert Nyman says:

    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 <code>application/xhtml+xml</code>. Good to know for people that want to have XHTML and ads.

    Jim,

    "If you use a strict doctype, you’ll get browsers to adhere as closely to the specification as they can".

    Absolutely true, no web browser is perfect. 🙂

    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…

    Again, true.

    That vas some valid nitpicking! 🙂

  • […]
    Jedisthlm.com: Behind the Nordea market information redesign Robert’s talk: HTML or XHTML? BrainFuel: Javascript Libraries (AJAX For Dummies) Mozilla Kicks Off &#8221 […]

  • l0b0 says:

    Having developed in HTML tag soup, tables for layout, and forms on one hand, and valid XHTML 1.1+CSS+<acronym title="Web Content Accessibility Guidelines">WCAG</acronym> 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?)

  • Robert Nyman says:

    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… 🙂

  • […] 3:32 pm Robert Nyman has a good post up called HTML Or XHTML? […]

  • Carlos says:

    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.

  • Robert Nyman says:

    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.

  • Henrik says:

    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

  • Henrik says:

    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.

  • […]
    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 […]

  • Robert Nyman says:

    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 <code>text/html</code>, 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 <code>application/xhtml+xml</code>?

    On top of that, I would have to use content negotiation to serve HTML to some web browsers as <code>text/html</code>, and XHTML to some web browsers as <code>application/xhtml/xml</code>; to have <code>object</code> elements for some web browsers and the <code>document.write</code> JavaScript 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 <code>application/xhtml/xml</code>.

    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.

  • 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.

  • MÃ&Acir says:

    Great article! Really mind-blowing stuff. Going to have think about this.

  • Robert Nyman says:

    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!

  • And Robert's opinion, is it avaliable either in View -> Page Source (when reading this post) ??

  • Robert Nyman says:

    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.

  • […] 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 […]

  • Henrik says:

    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…

  • Robert Nyman says:

    Henrik,

    Using the object element – does that necessarily break XML compliance? As far as I know it doesn’t.

    Depends on what you want to use it for. It isn't supported properly in IE for all its different kinds of usage.

    …it’s more on/off if a browser accepts the XML mime type or not…

    Well, yes, the most basic one. But it's inevitable that other issues or things you will use show up.

    When it comes to <code>document.write</code> as 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 uses <code>document.write</code> to display the ads.

  • […] 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. […]

  • […] 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 […]

  • […] 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 […]

  • […] sionante para IllUstrator: Scriptographer
    �HTML o XHTML?
    Versión original del artículo por Robert Nyman […]

  • […] 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 […]

  • Romuald says:

    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.

  • […] tood or even known about XHTML. I definitely recommend you spend five minutes reading it. The Article
    […]

  • George says:

    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 ….

  • Robert Nyman says:

    George,

    Basically, you can use either. But if serve it with the correct MIME type, <code>application/xhtml+<acronym title="eXtensible Markup Language">XML</acronym></code>, things like <code>innerHTML</code> (except for in Firefox) and <code>document.write</code> won'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?.

  • […] 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 […]

  • […] 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 […]

  • Stefan Van Reeth says:

    @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 :D.

    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.

  • Robert Nyman says:

    Stefan,

    I'm Swedish!

    …the differences in page rendering when using HTML is areason on it’s own to go XHTML.

    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.

  • […] 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 […]

  • […] oder Transitional? Diese Frage stellt sich mir viel eher als das ständige HTML vs. XHTML, wie hier, hier oder auch hier. […]

  • […] 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 […]

  • Jeric says:

    really both (XHTML HTML)are the web base today

  • Nathalie says:

    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?

  • Robert Nyman says:

    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.

  • Matt says:

    I also still don't know why you would use html as opposed to xhtml, the features are relatively the same.

  • kiran says:

    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

  • kiran says:

    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

  • kiran says:

    I dont know weather there is any solution for my problem!

  • Web Hosting Finder says:

    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

  • I think XHTML will strict you to code the website more neat and tidy.

  • 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

  • […] 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 […]

  • […] 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. […]

  • […] Versión original del artículo por Robert Nyman (autorizado por él mismo vía e-mail) […]

  • […] 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?. […]

  • Teandardelf says:

    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?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.