+ 8

What is the xhtml?is it better than html or not?

28th Nov 2019, 1:50 PM
Arsham
2 Réponses
+ 2
XHTML is basically HTML written in a way to be XML-compliant. XHTML is basically a kind of HTML which makes it difficult to compare the two. HTML5 is a more specific kind of HTML so I'll compare XHTML with HTML5. XHTML is very similar to HTML5 except that it is a type of XML language. Unlike HTML5, XML doesn't support empty tags and is case sensitive and hence XHTML has these extra rules like all tags and attributes must be lower case. Every element that would otherwise be empty such as meta, img, br, hr... needs to be closed with /> or immediately followed with a closing tag. Also, HTML5 is a simpler more universal standard for tags and attributes. XHTML can be linked to a variety of different DTD's which represent different variants of the language(different supported tags, attributes...). W3C abandoned XHTML in favour of HTML5. This is the biggest reason I would go with HTML5 instead of XHTML. W3C is in charge of both standards so their opinion matters. This is according to an answer at: https://softwareengineering.stackexchange.com/questions/149839/is-xhtml5-dead-or-is-it-just-an-synonym-of-html5 HTML5 is newer and more popular. XHTML was hip in the XML-related fashion trends of the 2000's but fell out of fashion in the 2010's. HTML5 is what most developers use now so generally go with that. HTML5 supports canvas. "canvas" is not supported in the more popular standard XHTML DTD's so that is another strength of HTML5 over XHTML. I didn't check but some of the more semantic tags such as nav, article, section, header, footer... are probably in HTML5 without being in the older XHTML DTD's. I found some mention of "XHTML5" from 2010 but I'm not sure if that references a DTD with the newer HTML5 tags.
28th Nov 2019, 6:23 PM
Josh Greig
Josh Greig - avatar
+ 6
Thanks josh for your complete answer
28th Nov 2019, 11:13 PM
Arsham