HTML vs XHTML does it still matter? [closed]

2019-01-16 20:21发布

I'm wondering if I should bother at all about the markup language, as long as i produce valid markup.

I've read articles that point out HTML is the best choice and they come directly from the horse's mouth (the browsers implementors!):

Other articles, by James Bennet, make another point that if you're not serving XHTML as XML then you don't want XHTML but HTML.

So i thought that if i wanted to trigger Standard Compliant Mode i should just use HTML strict validation. But that's not the case anymore with at least the most modern browsers (aka everything but IE6): if you have valid XHTML Strict you still trigger Standard Compliant Mode, hence, as long as i produce valid markup, why bother?

标签: html xhtml
7条回答
霸刀☆藐视天下
2楼-- · 2019-01-16 20:41

In most case, it does not matter. In fact, using XHTML cause more headache. However, there is a few situation that XHTML is needed. I can think of two.

First, if you want to use embeded SVG, you need XHTML.

Second, if you want to use HTML mark up as XML. Sometime (for unknown reason), I found that my AJAX request verify the code even when I mark it to be html or text. And to quickly avoid that, I change it to XHTML.

That is all.

查看更多
登录 后发表回答