tags:

views:

207

answers:

6

Which is better to learn HTML 5 or XHTML?

A: 

Both. I'd focus on XHTML as current browser support for HTML5 is pretty low.

Rob Stevenson-Leggett
The *new* features in HTML 5 aren't widely supported, but it incorporates a lot of commonly used tags and attributes that are invalid in XHTML (e.g., canvas and the target attribute).
Chuck
Did you know that IE has never supported XHTML? I'd say browser support for HTML(5) is still higher.
Ms2ger
+2  A: 

You mean "(x)HTML 5" aka "Web Applications 1.0" or "XHTML 2.0"? Since it will take a couple more years until one or both of these techniques will be fully usable, I would suggest starting with pure and simple XHtml1.0. You will find quite some good tutorials and you can use your xhtml with any actual browser. To later change or update your knowledge to the final draft and the small nuances will be very easy once you already know one of the old versions.

merkuro
+3  A: 

HTML 5 supports two syntaxes. One of those syntaxes is XHTML.

Don't limit what you learn: if you plan to write HTML in the future, learn about HTML 5 and understand both syntaxes it uses.

If you're writing HTML today, still learn about HTML 5, but stick to the tags which currently work (i.e. those compatible with HTML 4 or XHTML 2 as appropriate to the syntax you use.)

Peter Boughton
A: 

XHTML allows SVG graphics and other XML content to be embedded inline (this is a good thing for decorative flair). HTML5 is still undecided in this regard. Other than than it's probably 50/50. HTML allows you to be more sloppy with your code which might be a good thing while you're learning.

SpliFF
I'm not convinced if the tolerant attitude of HTML is a good thing for novices. I remember that the unforgiving nature of C compilers made me learn a lot back then even though that meant a steep learning curve.
DrJokepu
+1  A: 

XHTML specs are not backwards compatible which necessarily puts a damper on wide-spread adaption. Your investment in todays version of XHTML gives you nothing over todays HTML when moving to tommorrows version of XHTML. They are essentially the same source documents that can be trivially converted from HTML to XHTML.

All major browser vendors do not support XHTML which makes widespread adaption today impossible.

In my view Hand-coding documents in XML is not an ideal or bandwidth effecient endeavour. With HTML I don't need to worry about case sensitivity, spacing, having closing tags or /> syntax for items that don't need them. XML is too pedantic a syntax for widespread human consumption in my view.

I see too many people adding XHTML doctypes and actually thinking browsers are rendering XHTML when in fact they are ignoring the tags alltogether. I'm sure people have their reasons but I fear a non-trivial majority choose XHTML simply because its the latest buzzword.

The only actual benefit I know of currently to XHTML is that the format of the document can be validated using a validating XML parser. There have been HTML "lint" tools avaliable since Mosaic and Cello dominated the browser space.

Spec interpretations and rendering bugs have always dominated compatibility issues.. Expecting XHTML to make all your problems go away is not realistic in my view. I need not go any further than CSS :-(

Einstein
Not really true about the browser support. All the major players (yes even IE) support it as long as you feed IE the text/html content type. XHTML also allows other XML data to be incorporated into the document using namespaces, which is important so some applications like inline SVG.
SpliFF
XHTML is not supported by IE (including IE8). You must also use application/xhtml+xml or browsers will treat the XML as HTML and shall not be subject to XML validation rules.
Einstein
Contrary viewpoint: The primary consumers of HTML are web browsers, not programmers, as there are more of the former than the latter. It is much more important to make a language easily understood by a program (browsers and design tools) than easily written by a person. XHTML helps make it easier to create web pages that are more likely to be consistently rendered by web browsers.
Jacob
A: 

I would focus on HTML5. While there are features in HTML5 that are not widely supported, they are optional features; if you don't use them, your pages will still work properly, and you won't be any more hampered than if you used xhtml instead. Plus, browser support for those features is growing quickly, and even IE can be made to support much of the feature set through javascript shims.

marcus erronius