Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

HTML HTML Basics Getting Started with HTML What is HTML?

Stavros Sofroniadis
PLUS
Stavros Sofroniadis
Courses Plus Student 1,503 Points

Differences between HTML and XHTML

Dear Friends,

if you could mention any differences between HTML and XHTML.

Which of those 2 are more preferable to use when creating a web site?

In which cirmscustances do we XHTML rather than HTML and vice versa?

Can we use a combination of HTML and XHTML language in the same file?

Thank You,

2 Answers

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,253 Points

You will want to use HTML5 going forward as the preferred spec.

It's easy to remember as to use HTML5 you simply type

<!doctype html>

As your Document Type Definition.

The main differences are the elements you can use and HTML5 has default specs for embedding Audio and Video.

You can read more about the differences between the 2 here. https://hackr.io/blog/difference-between-html-html5-xhtml

Stavros Sofroniadis
PLUS
Stavros Sofroniadis
Courses Plus Student 1,503 Points

Thank You for answer.

Seems XTML is more stricter markup laguage rather HTML.(canot omit end tag)

It was mentioned in source document you mentioned that : 1)HTML4 allows overlapping of certain elements. XHTML doesn’t allow any elements to overlap.

2)Attribute values (such as font size) have to be quoted in XHTML, even if they are numeric. HTML doesn’t have include quoted values for attributes.

3)Attributes cannot be minimized in HTML.

If you could mention an example for 1,2,3 just for better understanding,

Also in the begining of source document was mentioned "However, before the release of HTML5, the World Wide Web Consortium (also known as W3C) started developing an extension of HTML based on the XML format to solve some browser compatibility issues."

dont understand the concept of extension regarding XTML, as mentioned World Wide Web Consortium has relesied many HTML editions(HTML2, HTML3,HTML4,HTML5). every newer edition has some improvements in relation with previous one.

XTML is extainable in relation with HTML wich aspect?