The main differences between XHTML and HTML5

What is HTML5?

HTML is the language used to write web pages, it describes the structure and content using only text and supplements with objects such as images, flash and others. The files created are saved with the extension of HTM or HTML file.

Their structure consists of labels or tags which are inserted between different elements of the page such as text blocks, scripts and the path to the location of external files such as images and other media files. The browser load those files properly representing all the files in it.

xhtml vs html5

What is XHTML?

After HTML4, XHTML arises in two versions: Transitional and Strict. It was mainly considered transitional and temporary use but now it surely represents a huge advance over the possibilities that it has introduced, always limited in trying to maintain compatibility with the specification above. It is much lighter and compatible with any browser, its disadvantage is that it has many restrictions, so many people are not easily habituated with the jump that represented their introduction and are still stuck in the previous language. Much pages today have been written using this language.

Differences between languages

Going along with the same there are several differences between the HTML5 and XHTML. The W3C has prepared a document calledHTML5 Differences from XHTML, detailing the main differences between XHTML and the new version of the language, HTML5. Though there are many such differences in both of them.

All items must be written in lowercase

This rule is common to all XHTML sublanguages. All tags must be written in lowercase letters, as well as their attributes. The only exception from this rule label is the label DOCTYPE used to make the document type declaration and subsequently commented.

All attributes must be quoted

All tags have attributes, these have to be quoted, even those that are numeric.

The minimized values are prohibited

Both HTML and XHTML, language elements can be formed by pairs of attribute – value. In HTML you can write certain values being minimized, while writing XHTML is complete without using any abbreviation.

All tags must be closed

In XHTML you must close all tags, including those in HTML was not necessary to close and also those that were unique tags which have no closing tag.

All tags must be properly nested

In HTML you can insert labels and then close them if take into account the nesting of the same. This type of action is correct in XHTML as the nesting requires closing tags in the correct order.

Avoid using strange characters

Since XHTML is stricter, sometimes if your page has scripts, they can be misunderstood, but the W3C stated that tags must be inserted between datastatement. Thebest is to have the scripts in external files with their respectiveextension.

The DOCTYPE declaration is mandatory

The DOCTYPE declaration at the beginning is necessary and mandatory. You cannot omit closing tags as in HTML Head or Body. Although in HTML the closures were presupposed if they were not provided in the document, XHTML does not have this feature that is why they must be included in the document.
The HTML5 validator does not care about the style of your code but will alert the misuse of items being placed where they should not be, required attributes of missing, incorrect attribute values.

So basically these are some of the main differences between them. In theory what changes is the way you write them, since HTML5 is more public based and XHTML is made looking from a programmer’s point of view.