Should I use HTML5 or XHTML?


Can we today get rid of XHTML tags (for example self closing tag like < element /> )? My main point is that I’m going to build a small project should I use HTML5 in it or XHTML? which one is preferable any why?

If you can’t decide then why not use XHTML5 - that’s the XHTML equivalent of HTML 5.

The biggest difference between HTML 5 and XHTML 5 (apart from their MIME type) is that XHTML 5 doesn’t have a doctype at all as there is only standards mode in XHTML and version 5 of both have done away with the SGML doctype so that HTML 5 only needs the short version to turn off quirks mode.

Of course XHTML isn’t supported in Internet Explorer 8 or earlier and (X)HTML 5 isn’t fully supported in any browser yet (since it hasn’t even been finished yet) so of all the current alternatives HTML 4 is the only one that works everywhere and XHTML 1 works everywhere other than old versions of IE. Of course (X)HTML5 is mostly supported in the latest version of each browser (apart from whatever they decide to change before they finish it).

HTML5 is the latest version…I would prefer to use HTML5…

There’s got to be a reason other than it’s “the latest version”. What makes html5 preferable over xhtml? If we jumped on the bandwagon every time a new version came out, we’d be constantly switching to a new technology and never having the chance to become an expert in the current one. At what point does it make sense to move on?

Nothing, really.

If we jumped on the bandwagon every time a new version came out, we’d be constantly switching to a new technology and never having the chance to become an expert in the current one. At what point does it make sense to move on?

The move towards HTML5 isn’t an overnight fad that will change tomorrow. It introduces new elements that will probably be around for a long time to come (for better or worse), such as <video> etc. But it’s still just HTML.

At the end of the day, it matters nought which doctype you use, as browsers will render the pages just fine—and that’s what counts. HTML5 is quite happy with the XHTML-style tags, such as <img />, so use whatever floats your boat. Personally, I’ve switched to the simpler doctype, because it’s neater and it works just fine.

You don’t need to learn anything new to use the new doctype. There are new elements you can use, if you wish, and you can continue to write your code just as you did before (closing off tags etc.). XHTML introduced some good coding habits, and that’s its legacy. There’s no need to throw that out. :slight_smile:

Is there even any practical benefit to XHTML? We were supposed to be able to use other markup languages, such as MathML and SVG, but 1) just because you can import tags doesn’t mean the browser will provide any default rendering for them, and 2) browsers already support the more popular markup such as SVG even in plain old HTML mode.

If all we want is just the strict syntax – lowercase tags, quoted attributes, optional closing tags nonetheless closed, etc – then it seems all we really need is a linter.

Also, keep in mind that unless you’re serving your pages as application/xhtml+xml – which virtually no one actually is – then you’re not actually using XHTML. It doesn’t matter even if your doctype says XHTML. If you serve it as text/html, then the browser is treating it as plain old HTML, and all those self-closing slashes aren’t really doing anything at all.

XHTML did do something good… it made web pages which were readable by standard XML parsers. IMHO that was a good thing… HTML5 without the same level of strictness makes it needlessly more difficult, which is a shame.

That’s because there are still too many people using IE8 which doesn’t support XHTML. Once IE8 dies out then it will become possible to use XHTML. At that point some people may start actually using it (or they may not - we’ll have to weait and see how popular it becomes).

Anyway XHTML doesn’t look like it is going to die out soon. The new XHTML 5 version is expected to become a standard next year at about the same time HTML 5 does.

Which brings me back to my question, “Is there even any practical benefit to XHTML?” If we could use true XHTML, then what could we do in XHTML5 that we can’t do in HTML5?

In those browsers that follow the rules it will be easier to detect some errors in the XHTML - since the page will only display up to the point where the error occurs. You will not have different browsers making potentially different assumptions as to how to handle the error in the code.

You should use according to your requirements but if you’re looking for the best one then use HTML5 cause it’s the latest version of HTML and as well as support all the feature of HTML. the functionality would be remain almost same but you can enjoy the different features of it.

HTML is not the latest version of HTML yet - it will be next year when it becomes a standard but at the moment HTML 5 and XHTML 5 are still in development and subject to change.

yes we can user HTML 5. but html5 is not all browser support. don’t worry any browser we can support html5 by using css, jquery.

Since that discussion took place.

Now what many people forget is the SEO part of any version of Html.
IMO Html is the biggest tool one has at his fingertips to push a site up in ranking. Cms, something not mentioned here is all about the SEO friendly structure.

OK those systems can have a SEO friendly domain extension and have even an Alt tag. but there are more tags to a site and there are more names to folder, images (which can also be named before uploading) and else what can be done on html. For a good SEO you need to know how a spider sees your site. True now with panda 4 content has a bigger percentage but that is a lesser problem in html.

For any smaller site you need to find out what your regional clients have as browsers, where I live Iexplorer 8 is kind of advanced. A larger site like 20 to 100 pages in dimension php is way better than CMS.

Specially when trying to get people without much knowledge into designing their own sites CMS has quiet a few short comings, one mistake, one change of an image and the site looks so different people regret having even looked at CMS. Cms is sold as the new site develop software even so it just gives the designer a way shorter development time, kind of cheating IMO.

CMS is not the issue here the question is “Should I use HTML5 or XHTML” ?

Well have a look into your servers user stats and see what kind of browser they are using to browse through your site. That would give you a nice picture. You could also try to use a system where you have browsers like Iexporer6 just to see if the browser garbles your site out in a way no-one in his mind would allow that to happen to his site. You can mix even both styles and see how it is interpreted. A spider has a very different way seeing stuff, it crawls through our sites and decides what is good content and what is not. Those critters read tags more than Html5 allows and like tags even more than flashy images.

Lets have a look at your site surely by now it has been finished :slight_smile: how have you decided?

No the question should be “Should I use HTML5 or XHTML5” - the answer to which currently depends on whether or not you need to support IE8.

If I’m not mistaken that is what I said. Sure quite late at the end of my Rant vs CMS customization, wouldn’t you agree?

Not quite. Notice the 5 on the end of felgall’s comment. That makes it quite a different question. :slight_smile:

Honestly, if you can’t decide on which one you want to use, try out both for about an hour each. I prefer HTML5, but I have no experience with XHTML.