1

Is there a practical reason to learn xhtml still? Should I learn to make my webpages in xhtml instead of html5 still or does it matter?

maxfielden
  • 473
  • 4
  • 9

4 Answers4

5

If you are new to HTML then you need to learn the fundamentals of HTML first before diving in to HTML5 (which is to some extents still a moving target). Why? Because nearly every web-site, tutorial and example code you will encounter regarding HTML will be written in HTML4 or XHTML. You can only really understand the problems that HTMl5 is addressing by first understanding HTML4 and XHTML.

If you hope to work as a web-developer or designer then you won't be able to avoid encountering "legacy" code - so you need to at least understand it and be comfortable with what it is doing. Unfortunately you'll find that the "web" and "standards" are often two different things - for many years HTML has been a mess because of the way different browsers have interpreted (and often blatantly flaunted) the standards. So, at the very least, you need to be aware of this.

Dan Diplo
  • 3,900
  • 1
  • 27
  • 30
  • Ok, that's a well put reason for me to learn HTML4 and XHTML. Thank you. – maxfielden Jun 20 '11 at 09:19
  • @maxfielden learning HTML5 includes learning HTML4. HTML5 is a (mainly) superset. there's no reason to specifically learn html4/xhtml, learning html5 should include learning html4. – Raynos Jun 20 '11 at 14:01
  • @Raynos but you still need to know what has been deprecated and what has been added between 4 and 5. Otherwise, if you have to work on an HTML4 "legacy" site (and that probably encompasses 99.99% of the existing web) you'll not have a clue what is valid or not – Dan Diplo Jun 20 '11 at 15:13
  • @DanDiplo you don't really need to know about that. Because 99% of "legacy" HTML4 websites don't validate in W3C anyway, so you don't really care. It's bad practice to use most of the things that are deprecated in HTML5 because a) they are deprecated for a reason and b) it does not make the website future facing. And we should also destinquish between what's actually new in HTML5 and the WHATWG features that people think is in HTML5 because all those other APIs have been thrown under the HTML5 buzzword. – Raynos Jun 20 '11 at 15:19
  • 1
    @Raynos ... and if you only know HTML5 and have to work on an HTML or XHTML site you will know what features of HTML5 *won't* work by intuition alone? For instance, just take doctypes, rendering modes, box model and compatibility modes as one small part. HTML5 may do away with these problems, but doesn't mean they don't still exist for the vast majority of existing sites. You can't call yourself a web-developer and be ignorant of them. – Dan Diplo Jun 20 '11 at 15:29
  • @DanDiplo you have a good point. I can't really consider HTML5 a super set of HTML4. Yes you do need to learn HTML4, I still recommend you learn HTML5 as well and upgrade any website you can to HTML5 using Modernizr and other tools. – Raynos Jun 20 '11 at 15:33
1

Start with HTML simply and then slowly adopt other variations. HTML is a well-defined language just like XHTML

View already answered question on stackoverflow.com

https://stackoverflow.com/questions/413114/html-vs-xhtml-does-it-still-matter

Pir Abdul
  • 111
  • 7
  • A working knowledge of HTML 4 is going to be essential for some time to come. It is the lingua franca of the web, and isn't going to go away. XHTML is mostly just HTML 4 with an XML serialisation; if you know HTML 4, XHTML is pretty trivial. HTML 5 is a bigger leap, and since it isn't even standardised yet, something for a beginner to stay away from for now. – Tom Anderson Jun 20 '11 at 12:20
  • yes the only difference is XML Serialization and some other points. – Pir Abdul Jun 20 '11 at 12:27
0

"bother" with as much as you can (since you seem to be in the early stages). you only stand to learn more. nothing to lose

Chani
  • 1,435
  • 2
  • 15
  • 25
  • 2
    Except people don't have infinite time, and don't want to waste half of their lives to learn unnecessary technologies. – Davor Ždralo Jun 20 '11 at 09:02
  • @davor i think since he is a beginner .. he shud himself learn first hand that XHTML is a bad choice. the experience is worth it – Chani Jun 20 '11 at 10:36
0

XHTML has always been an invalid choice to start with. Essentially no site that advertises it will validate anyway, and the rare that do almost never serve the correct header.

Serve good old HTML 4.01, or HTML 5.

Denis de Bernardy
  • 3,913
  • 21
  • 18
  • 1
    So, paraphrasing, "XHTML is almost always used in the wrong way, so don't bother." That's the case with HTML as well, and is part of the reason why the web is still buggy and slow. – l0b0 Jun 20 '11 at 08:44
  • @l0b0 -- More like: with HTML, his odds of making a non-trivial page validate at all are much higher. – Denis de Bernardy Jun 20 '11 at 08:48
  • @Denis: Noone serves the right header because IE breaks horrifically when you do. – Matthew Scharley Jun 20 '11 at 09:56
  • @Matthew: noone serves the right header, because widgets, share/tweet buttons, ad services and what not are almost guaranteed to turn valid markup into invalid markup. – Denis de Bernardy Jun 20 '11 at 10:13
  • @Denis why bother supporting something that's broken for half your market share? Sad but true fact. Doesn't make it a bad idea when you don't need to integrate with those other services. XHTML was and still is a good idea, and there is XHTML5 for those who still wish to use it. – Matthew Scharley Jun 20 '11 at 10:35
  • 3
    The power of XHTML is not in the browser, but _server-side_. It is very clear that your "invalid choice" source have not understood this. –  Jun 20 '11 at 11:33