Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the main differences between XHTML and HTML? [closed]

Tags:

html

xhtml

What are the main differences between XHTML and HTML? Which one is better in your opinion, and why? Do most browsers support both?

like image 664
alsadk Avatar asked Oct 12 '08 18:10

alsadk


People also ask

What are the differences between XHTML and HTML?

HTML and XHTML FeaturesHTML is the standard markup language for creating web pages, while XHTML is a stricter and more standardized version of HTML. Both HTML and XHTML include a wide range of features, such as support for multimedia, styling, and scripting.

Which of the following is a major difference between HTML5 and XHTML?

Key Differences Between XHTML vs HTML5XHTML is a combination of HTML and XML, whereas HTML5 is a version of HTML. XHTML has its own parsing requirements, while HTML does not have any specific requirements and uses its own. In XHTML, all tags, if they are opened, then they should be closed.

How is XHTML better than HTML?

XHTML was developed to make HTML more extensible and flexible to work with other data formats (such as XML). In addition, browsers ignore errors in HTML pages, and try to display the website even if it has some errors in the markup. So XHTML comes with a much stricter error handling.

How XHTML is different from HTML list the rules followed in XHTML?

XHTML can be thought of as an extension of HTML. HTML is made of elements (with 3 components – pair of element tags, element attributes and content) while XHTML has only one root element. Secondly, XHTML is a lot stricter when it comes to the file's structure and coding.


2 Answers

XHTML is based on XML, and thus requires the source to be well-formed. Since XHTML is more strict than HTML, less pre-processing is needed by the rendering engine.

XHTML should be served as application/xhtml+xml for you to take advantage of the benefits, otherwise XHTML will be treated as ordinary HTML. Serving it as 'application/xhtml+xml' is not common on the web due to Internet Explorer, which cannot handle XHTML.

like image 131
Andy Avatar answered Nov 05 '22 09:11

Andy


This is probably the best article I've read on the differences and relative merits of each:

HTML Versus XHTML

Which should we use, HTML or XHTML, and why?

There is also a rather technical comparison on the WHATWG wiki.

like image 22
Charles Roper Avatar answered Nov 05 '22 07:11

Charles Roper