What is html xhtml and html5

HTML vs HTML5 vs XHTML: Differences You Should Know

The terms HTML, HTML5 and XHTML are frequently used in web design. Most people who are new to web design, often find these terms confusing and don’t know which language of these three to learn. The confusion is understandable because all of them are markup languages and essentially serve the same purpose. To clear out the confusion, let’s take a look at their differences in detail.

Markup Languages: What Are They?

Markup Languages are the essential tools required to create a webpage. Each webpage has some text, images, or any other sort of structured data displayed to the user. Presenting the textual or visual information to the user defines the markup of a website. In designing a webpage, we may need different fonts for different words, different colors for different types of text, and so on. We also need a universality in the markup, i.e., the webpage requires to look the same irrespective of the browser. It makes it necessary to have a standard markup language through which web pages can present information to the user.

Markup Languages use tags to determine the presentation format of the data. Tags are used to represent data in a structured and organized way. Common examples of tags include header tags, body tags, and so on. The most common markup language for web pages is HTML, which was designed by Tim Berners-Lee, the inventor of the World Wide Web.

HTML, which stands for HyperText Markup Language, was the first internet-based markup language used for web pages. However, HTML quickly evolved, and with the release of subsequent versions of it, it became a sort of standard for markup languages. Although HTML is more of a standard than a single language, so are commonly referred to as HTML itself up to versions up-to HTML4. It is because of the need to differentiate it from the significant changes brought in by HTML5, which is the next and latest version of HTML.

However, before the release of HTML5, the World Wide Web Consortium (also known as W3C) started developing an extension of HTML based on the XML format to solve some browser compatibility issues. XML is another standard of markup language that is very similar to HTML but is somewhat stricter than HTML in error handling and formatting. The resulting language was named XHTML, which stands for eXtensible HyperText Markup Language. It was very similar to HTML4 but introduced some stricter rules.

Читайте также:  Php добавить к каждому элементу массива

Difference between HTML vs XHTML vs HTML5

Now let’s explore some of the differences in greater detail.

HTML vs HTML5

A group known as WHATWG developed HTML5 and was designed to improve upon the previous HTML versions and solve some cross-browser compatibility issues. We’ll use ‘HTML’ to refer to the pre-HTML5 versions of HTML. The key differences between HTML and HTML5:

Basis of Comparison

Hypertext Markup Language, the primary language for developing webpages

A new version of HTML, offering new functionalities to interact with internet technologies for structuring and presenting the content.

Media Support

It does not offer any support for video and audio for any language.

Offers support for audio and video as integrated into the language.

Geographical Support

The process of tracking the user’s location is cumbersome and all the more complicated if the user is logged in on mobile devices.

The language uses JavaScript Geolocation API that is used to identify the location of any user accessing the website.

Uses Browser cache memory as temporary storage.

Equipped with multiple storage options like web storage, SQL database, and application cache

Communication

Communication between client and server is done with the assistance of streaming and long pooling as it does nit offer socket support.

The language allows full-duplex communication between client and server.

Browser Compatibility

As it is old, so all browsers support it.

Compatible with only a few browsers as it introduces new tags and elements.

Graphic Support

Needs third-party tools to provide vector graphic support.

Vector graphic support is by default as it has canvas and SVG built.

JavaScript and browser interface running in the same thread leads to performance issue.

It offers JavaScript web API support, which allows JavaScript and browser interface to run on different threads.

Error Handling

Not capable of handling inaccurate syntax or any other errors

Capable of handling incorrect syntax or any other errors

In short, HTML5 is just a better version of HTML with added features and functionalities.

HTML vs XHTML

XHTML was developed as an extension to HTML. There aren’t many differences between HTML4 and XHTML, and XHTML is a stricter version of HTML4. The main differences between HTML and XHTML are:

Basis of Comparison

Abbreviation

Hypertext Markup Language

Extensible Hypertext Markup Language

Case Sensitivity

It has markup language as the format.

Requires lenient HTML specific parser.

Needs to parse with a standard XML parser.

There are no well-formed concern constraints.

There are no well-formed concern constraints.

While the above are the more significant differences, there are also some very subtle differences, but they are really rare to run into. You can always check out the documentation of XHTML for more information. The takeaway is that XHTML was designed to solve some problems in HTML, by incorporating some features of XML.

HTML5 vs XHTML

Since XHTML and HTML are largely the same, the differences between XHTML and HTML5 are the same as the ones between HTML4 and HTML5. However, the following are some of the subtler differences between HTML5 and XHTML:

Читайте также:  Основные паттерны программирования java

Basis of Comparison

Case Sensitivity

Developed by

World Wide Web Consortium (W3C)

Collaboration between Web Hypertext Application Technology Working Group (WHATWG) and the World Wide Web Consortium (W3C).

Features and Benefits

  • A combination of HTML and XML
  • It defines a standard for web pages that can be represented by all XHTML enabled browsers.
  • XHTML pages can be easily edited and formatted and provide easy maintenance.
  • It gives a well-structured and consistent format that can be quickly processed and parsed by all web browsers.
  • The XHTML documents can use applications such as applets and scripts. These applications depend on the HTML document object model or XML document object model. The documents can be viewed as edited and validated using an XML tool.

The primary features supported by HTML5 are:

  • Drag and Drop: Allows users to drag and drop elements from one location to another on the same webpage.
  • Geolocation: Allows users to share location on various web applications.
  • Server-Sent Events (SSE): This facility in HTML5 lets events to flow to web browser from the webserver. These events are called Server sent events.
  • New elements: Several elements such as , and have been added
  • Microdata: Using this facility, users create their vocabularies beyond HTML5 and extend the web pages with the custom semantics.

While writing code for XHTML, consider the following:

  • Tags must be nested properly.
  • All XHTML attributes and tags should be in lower case.
  • All XHTML documents should start with the DOCTYPE declaration.
  • The user must replace a name attribute with an id attribute.
  • Disapprove the language attribute of the script tag.
  • Uppercase tag names
  • Attribute values are optional
  • Closure of empty elements is optional
  • Quotes are optional for attributes.
  • Provides tags like:
    • Document tags like:
      • Figure
      • Nav
      • Article

      A few attributes associated with XHTML are as below:

      • Core attributes: class, id, style, and title.
      • Language attributes: indicates the language used.

      It also has Microsoft Proprietary attributes that include accesskey, language, tabindex, hidefocus, and more.

      A few features are listed below:

      • Align: Used to align tags to the right, left, or center.
      • Hidden: Specifies if the element should be hidden or not
      • Itemprop: Used to group items
      • Tabindex: Specifies the tab order of any element
      • Data-XXXX: Helps to customize attributes, and allows the author to define their attributes.
      • XHTML provides elements like and such attributes can be used to trigger Javascript.
      • It has level events which trigger when element changes, a form is submitted, and more.
      • It supports keyboard events, as well.

      HTML5 supports event handlers in javascript and allows users to specify those as a value of event tag attribute. It also supports events like document load, window focus, etc.

      Conclusion

      In conclusion, all three are markup languages with just some features present in each which aren’t present in the others. While XHTML was designed to be a better version of HTML4 by incorporating some features of XML, HTML5 turned out to be far better than the both and is by far the most widely used markup language today because of the addition of many essential features.

      The main takeaway is that all of them are just different versions of the HTML standard of markup languages, but with different syntactic styles and features. If you are a beginner at web design, we do not recommend HTML4 and XHTML, and it would make sense to learn HTML5 first because of it’s enhanced compatibility and widespread usage.

      Which of the three markup languages do you find easy to learn and use in your projects? Share your experiences in the comments below.

      If you’re looking to use your HTML skills to build your own website, we recommend using NameCheap to buy your domain name and web hosting services. They’re the best in the industry and super affordable.

      People are also reading:

      Источник

      HTML Versus XHTML

      XML is a markup language where all documents must be marked up correctly (be «well-formed»).

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

      If you want to study XML, please read our XML Tutorial.

      The Most Important Differences from HTML

      • is mandatory
      • The xmlns attribute in is mandatory
      • , , , and are mandatory
      • Elements must always be properly nested
      • Elements must always be closed
      • Elements must always be in lowercase
      • Attribute names must always be in lowercase
      • Attribute values must always be quoted
      • Attribute minimization is forbidden

      XHTML — Is Mandatory

      An XHTML document must have an XHTML declaration.

      The , , , and elements must also be present, and the xmlns attribute in must specify the xml namespace for the document.

      Example

      Here is an XHTML document with a minimum of required tags:

      XHTML Elements Must be Properly Nested

      In XHTML, elements must always be properly nested within each other, like this:

      Correct:

      Wrong:

      XHTML Elements Must Always be Closed

      In XHTML, elements must always be closed, like this:

      Correct:

      This is a paragraph

      This is another paragraph

      Wrong:

      This is a paragraph

      This is another paragraph

      XHTML Empty Elements Must Always be Closed

      In XHTML, empty elements must always be closed, like this:

      Correct:

      A break:

      A horizontal rule:


      An image:

      Wrong:

      A break:

      A horizontal rule:


      An image:

      XHTML Elements Must be in Lowercase

      In XHTML, element names must always be in lowercase, like this:

      Correct:

      Wrong:

      XHTML Attribute Names Must be in Lowercase

      In XHTML, attribute names must always be in lowercase, like this:

      Correct:

      Wrong:

      XHTML Attribute Values Must be Quoted

      In XHTML, attribute values must always be quoted, like this:

      Correct:

      Wrong:

      XHTML Attribute Minimization is Forbidden

      In XHTML, attribute minimization is forbidden:

      Источник

Оцените статью