Comparing HTML and XHTML


In the beginning, web designers built websites with HTML (Hypertext Markup Language). Today, with the combination of XML (Extensible Markup Language), XHTML (Extensible Hypertext Markup Language) was created to provide stricter code that will be the standard coding language used by all browsers and applications. If you have been using HTML for a while, you will notice the differences, but it will not be too difficult to switch to XHTML.

  1. The DOCTYPE definition and XMLNS attribute – One of the first differences you will notice in an XHTML document is the DTD (Document Type Definition), or simply DOCTYPE definition, which is seen as the very first tag. It is always written at the beginning of the document, which tells the browser what sort of building blocks are used in the document so that it can be read properly. This is an example of how the DOCTYPE definition should be written at the beginning of your XHTML document:

    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

    Note that the DOCTYPE definition must be written properly, or else the document will fail to initialize. Another important tag at the beginning of the document is the XMLNS attribute found under the DOCTYPE definition. It is required in all XHTML documents and will look like this:

    Do not forget to write this tag at the beginning before doing any coding.

  2. Proper order of tags – The tags in an XHTML document must be ordered correctly, unlike in HTML, where you can get away with poorly ordered tags. This is an example of how the basic tags should be ordered in your XHTML document:

    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">






    The HEAD tag is found at the top, containing the TITLE tag, which gives your document a name or title and will be displayed on the browser's title bar. The BODY tag follows after the HEAD tag; the content for the website will be contained in this tag. Other formatting tags contained within the BODY tag should also follow the proper order for the document to display its content the right way. Take, for example, the

    paragraph tag, where you start typing in your content; the closing tag

    should not be written outside of the tag. When you use other tags to format content within the

    tag, they too have to follow the tag-ordering style.
  3. Case sensitivity and closing tags – In HTML, you can use either capital letters or lowercase letters, or both at the same time, in tags, but in XHTML all elements and attributes must be written in lowercase to keep tags consistent. All tags that are used in the XHTML document must be closed with the proper closing tags, or else the document will not function correctly.

These are just a few differences between HTML and XHTML, but these are some of the most important details that you need to remember when coding in XHTML.









Comparing HTML and XHTML


Comparing HTML and XHTML : Multi-thousand tips to make your life easier.


In the beginning, web designers built websites with HTML (Hypertext Markup Language). Today, with the combination of XML (Extensible Markup Language), XHTML (Extensible Hypertext Markup Language) was created to provide stricter code that will be the standard coding language used by all browsers and applications. If you have been using HTML for a while, you will notice the differences, but it will not be too difficult to switch to XHTML.

  1. The DOCTYPE definition and XMLNS attribute – One of the first differences you will notice in an XHTML document is the DTD (Document Type Definition), or simply DOCTYPE definition, which is seen as the very first tag. It is always written at the beginning of the document, which tells the browser what sort of building blocks are used in the document so that it can be read properly. This is an example of how the DOCTYPE definition should be written at the beginning of your XHTML document:

    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

    Note that the DOCTYPE definition must be written properly, or else the document will fail to initialize. Another important tag at the beginning of the document is the XMLNS attribute found under the DOCTYPE definition. It is required in all XHTML documents and will look like this:

    Do not forget to write this tag at the beginning before doing any coding.

  2. Proper order of tags – The tags in an XHTML document must be ordered correctly, unlike in HTML, where you can get away with poorly ordered tags. This is an example of how the basic tags should be ordered in your XHTML document:

    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">






    The HEAD tag is found at the top, containing the TITLE tag, which gives your document a name or title and will be displayed on the browser's title bar. The BODY tag follows after the HEAD tag; the content for the website will be contained in this tag. Other formatting tags contained within the BODY tag should also follow the proper order for the document to display its content the right way. Take, for example, the

    paragraph tag, where you start typing in your content; the closing tag

    should not be written outside of the tag. When you use other tags to format content within the

    tag, they too have to follow the tag-ordering style.
  3. Case sensitivity and closing tags – In HTML, you can use either capital letters or lowercase letters, or both at the same time, in tags, but in XHTML all elements and attributes must be written in lowercase to keep tags consistent. All tags that are used in the XHTML document must be closed with the proper closing tags, or else the document will not function correctly.

These are just a few differences between HTML and XHTML, but these are some of the most important details that you need to remember when coding in XHTML.


Comparing HTML and XHTML

Comparing HTML and XHTML : Multi-thousand tips to make your life easier.
Comparing HTML and XHTML
Comparing HTML and XHTML
Recommend to friends
  • gplus
  • pinterest

Comment

Leave comment

Rating