Your Search Results


    HTML can travel over the network to a browser either in HTML syntax or XML syntax, also known as XHTML.


    The HTML5 standard defines both these syntaxes. The choice of syntax is indicated by the MIME type (which is sent in the HTTP Content-Type header): the MIME type for HTML syntax is text/html, and the MIME type for XHTML syntax is application/xhtml+xml.

    This example shows an HTML document and an XHTML document including the relevant HTTP headers:

    HTML document

    HTTP/1.1 200 OK
    Content-Type: text/html
    <!DOCTYPE html>
    <html lang=en>
        <meta charset=utf-8>
        <p>I am a HTML document</p>

    XHTML document

    HTTP/1.1 200 OK
    Content-Type: application/xhtml+xml
    <html xml:lang="en" xmlns="">
        <p>I am a XHTML document</p>

    MIME type versus DOCTYPE

    Before HTML5, the two syntaxes were defined by two separate specifications: HTML 4.01 and XHTML 1.0. According to the XHTML1 standard,  you could use XHTML by declaring a special DOCTYPE. However, no browsers have ever implemented this, and the HTML5 standard has reversed the decision. If your page is sent as text/html, you are not using XHTML.

    Instead, the proper MIME type must be present in the Content-Type HTTP header. If you only put the MIME type into an HTML meta tag like <meta http-equiv=…>, it will be ignored and treated like text/html.

    If you serve your pages as text/html and believe that you are writing XHTML, you may face several problems, as described in these articles:


    Most modern browsers support XHTML, including Firefox, Chrome, Safari, Opera, and Internet Explorer (since IE 9). (Internet Explorer 8 and older browsers instead show a download dialog box for unknown file types when they see an XHTML document with the correct XHTML MIME type.)

    Also be aware that many popular JavaScript libraries and developer tools have limited or no support for XHTML.

    Differences from HTML

    See Properly Using CSS and JavaScript in XHTML Documents for a partial list of differences between HTML and XHTML.


    See also

    View All...

    Document Tags and Contributors

    Last updated by: Andrew_Pfeiffer,