Pin Me

Understanding the Differences Between HTML and XHTML

written by: •edited by: Michele McDonough•updated: 3/4/2011

They might look the same, but there are some particular differences between HTML and XHTML that make them suited for different purposes.

  • slide 1 of 5

    XHTML: A Version of HTML

    What is the Difference Between HTML and XHTML Over the years since the birth of the World Wide Web, various versions of HTML have been used, each with its own set of version-specific tags and even a few browser-specific ones. However HTML as previously known and used has largely been superseded by XHTML.

    To many, the difference between HTML and XHTML might be pretty superficial; after all, they’re both ways of creating webpages, they both use markup <> tags and they sound pretty similar too.

    In order to know where we’re going, we need to know where we’ve been. Therefore, an understanding of both HTML and XHTML is required.

  • slide 2 of 5

    Markup: The Purpose of HTML

    Since the beginning of the World Wide Web, HTML has been used to create web pages; these have either been static pages coded at length by hand or a useful application or database-driven dynamic pages that mix PHP, ASP or some other code with traditional HTML.

    Different versions of HTML have been released over the years: the original format featured all markup (the term used to describe the use of <> tags) expressed in upper case letters, something that was revised with HTML 4 (released in 1998) in order to make it easier to distinguish between the HTML tags and the Document Type Declaration (DTD) at the top of the HTML document (note that this is merely convention; HTML remains case-insensitive).

    The purpose of HTML is simply to form web pages that can be parsed and displayed in a standard web browser.

  • slide 3 of 5

    Flexibility: Purpose of XHTML

    Developed from HTML 4, XHTML is basically HTML combined with XML. XML is a version of HTML that uses tags defined in a separate document rather than sticking to tags defined by the W3C (the body that oversees web language specifications). XML is therefore useful for sending information across the web from applications to central servers (such as banking information), and is most commonly used by RSS feeds.

    Unlike HTML, XHTML tags must be in lower case type, and are case-sensitive, so errors concerning case can be common if hand-coding XHTML.

    Many new websites are written in XHTML, a testament to its flexibility.

  • slide 4 of 5

    Differences Between HTML and XHTML

    The main differences between the two languages are in the syntax. XHTML for instance requires lower case tags and that all tags are closed, either by means of a closing tag or – where appropriate – a self-closing tag such as <br />. While HTML tags should be closed, some are automatically closed if no closing tag is present.

    XHTML documents can also be viewed in XML parsers, whereas HTML documents can only be viewed as designed in a web browser (or HTML-friendly word processor).

    Despite the similarities between the two markup languages, differences between them look set to continue, with development of HTML5 and XHTML5 taking place separately.

  • slide 5 of 5



    • Author's own experience
    • W3Schools,

    Screenshot provided by writer