Which one is better and why for a new project? I'm assuming all will be strict, as I see no reason to go transitional for a new project.
The specification for version 4.01 of the HTML markup language was published as a W3C Recommendation in December 1999. HTML 4 was widely used in the late 1990s and 2000s and many sites using this version of HTML are still to be found on the Web.
Both HTML and XHTML include a wide range of features, such as support for multimedia, styling, and scripting. HTML is the standard markup language for creating web pages, while XHTML is a stricter and more standardized version of HTML.
XHTML 1.0 Strict is the XML equivalent to strict HTML 4.01, and includes elements and attributes that have not been marked deprecated in the HTML 4.01 specification. As of November 2015, XHTML 1.0 Strict is the document type used for the homepage of the website of the World Wide Web Consortium.
XHTML is a combination of HTML and XML, while HTML5 is a version of HTML. XHTML has its own parsing requirements, while HTML does not have any specific requirements and uses its own. Know more about what is the difference between XHTML and HTML5 from the table below.
HTML 4.01 vs. XHTML 1.0
The problem with both of these is that they have been effectively rendered obsolete by HTML5.
In fact, you're really asking the wrong question. HTML4, XHTML and HTML5 are basically the same language, but with certain features missing from one to the other.
The really important thing (and probably the reason why you may feel like you have to choose) is that it is important to specify a doctype, in order to prevent older browsers dropping into quirks mode. At the point where you find you have to specify a doctype, you also find yourself presented with a choice of which one to use, and the syntax makes it look like you have to get it absolutely perfect or it'll all stop working.
But you don't need to worry about that. The following doctype is sufficient to make all current browsers (including IE6) run in standards mode:
<!DOCTYPE html>
Simple, eh? No need to worry about HTML4 vs XHTML at all.
The thing is, the above doctype also happens to be the doctype for HTML5. It was chosen deliberately because it works in existing browsers.
If you need to support older browsers, you don't have to use HTML5's flashy new features, but using this doctype means that you will be ready to use them when the time comes. And if you do feel like dipping your toe in the water, a lot of the new features will degrade gracefully in older browsers, so you can use them; they may not work in IE6, but they won't break the browser either.
I hope that helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With