hey people i am starting to learn making websites, now i want to know what is the difference b/w HTML and XHTML; kindly keep it simple and jargon free pls. :)

also, what mark up language i shall use between these two to start with?

6 Answers 6


Instead of reinventing the wheel, here's a great post explaining the difference between the two. But to quote w3schools and give you a basic summary:

The Most Important Differences:

XHTML elements must be properly nested
XHTML elements must always be closed
XHTML elements must be in lowercase
XHTML documents must have one root element

They're so similar that it really doesn't matter which one you learn first as the differences are minor for what you want to do. I'd say start with HTML as it is technically simpler and branch out to xHTML once you think you're ready.


Adding to the recent responses, it is beneficial to know the differences between HTML4.01 & XHTML 1.0 and the previous responses sum those differences up. Already stated too that you should start learning about the new elements introduced into HTML5 and the minor changes in semantics. The great thing about the HTML5 spec is that it was built, in the loosest sense, backwards compatible with your HTML4.01 or XHTML code. Meaning that your (X)HTML page can instantly become an HTML5 page with simple substitution of the old doctype with the new <!doctype html>. An excellent resource for an HTML5 summary - Dive into HTML5

If you do decide to go the HTML5 route which I'd recommend, there are drawbacks as older Internet Explorers like versions 6-8 that will not recognize new HTML5 elements like article or aside. However there are a few javascript libraries that allow those dated browsers to recognize the new elements so that you may be able to style them. Check out Modernizr or html5shiv


Important differences (referenced from W3schools, I know, I know)

  • XHTML elements must be properly nested
  • XHTML elements must always be closed
  • XHTML elements must be in lowercase
  • XHTML documents must have one root element

So it's not a different language, it's a different set of standards.

I recommend you start learning HTML5, it's the future, and it's pretty mature at the moment. There really isn't much difference between them all when learning the basics and getting going, but you should probably just pick the most up to date one.


I agree with Tom, that you should probably start learning HTML5, but I wouldn't do that solely as it's not 100% right now. XHTML will basically teach you better coding habits because it is a little more strict in regards to properly closing, nesting naming, etc. I would say to start with XHTML for the basics and learning good coding habits, then start to learn the new bits of HTML5. Good coding habits help your end users, those who may follow behind you, and yourself later on down the road.

While you are learning, run your pages through the validator: http://validator.w3.org/ This will point out where you are making your mistakes and will not only help you write and release valid code, but can help with revealing problem spots you may have.


I suggest starting with HTML5, which will become, essentially, the HTML 4.01 of the future (a.k.a. the HTML standard of the future). Learning XHTML coding habits, however, isn't a bad idea, as a stricter ruleset for writing (X)HTML pages prevents you from having issues with sloppy code.

Some of the key features of XHTML:

  • XHTML elements and attributes are all lowercase
  • XHTML elements must be closed (sometimes with a self-closing tag /)
  • XHTML must declare a root namespace (also known as xmlns, though this isn't necessary in HTML5)

Having properly nested elements is technically a requirement for validating HTML, but many HTML writers write sloppy code that isn't properly nested (such as <strong><em>Test</strong></em>), so it's (wrongly) associated with XHTML sometimes.

I highly recommend using the (X)HTML validator and the CSS validator to validate your code while you write, to maintain a good practice of having valid code.

If you have any code-related issues, you may post them at Stack Overflow, another one of our projects.


Html is a markup language used to create webpage whereas XHTml is family of xml that extend version of markup language.

Html is an application of Standard Generalized Markup Language (SGML) and XHtml is an application of XML.

XHTML was developed to make HTML more extensible and flexible to work with other data formats. 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.