DEV Community

Cover image for Why HTML5?

Posted on • Originally published at

Why HTML5?

Let us take this moment and revisit! Why HTML5?

Let us refresh the features provided by HTML5 and how they are helpful in today’s world of web development.

Thanks to the rise of new gadgets, such as smartphones, tablets, mobile watches, IoT, and many more, accessing the internet has become way easy! This has increased the need for similar user experience across all devices.

Alt Text

There was a need to have a seamless experience across all devices

HTML5 has lots of new features including support to multimedia, new tags, minimal usage of external plugins, etc

Alt Text

The HTML markup language has very much evolved with time and HTML5 is the latest version that comes with a plethora of new features and efficiency in the web development galaxy. The latest version is better integration of CSS, Java, and HTML components that are focused to make it easy for developers to create better apps and make the whole technology better accessible for mobile devices.

So let us go through the features and how to use them, in easy steps.

Feature 1: Doctype declaration is quite simple and easy.

<!DOCTYPE html>
        <title>Title of the document</title>
        The content of the document......
Enter fullscreen mode Exit fullscreen mode

Feature 2: Supports audio and video controls

For Audio: Just need to add audio controls tag

<audio controls>
     <source src=<YourMP3AudioFile.mp3> type="audio/mpeg”> 
     Your browser does not support audio
Enter fullscreen mode Exit fullscreen mode

For Video: Just need to add video controls tag

<video controls>
      <source src="YourMP4VideoFile.mp4" type="video/mp4">
       Your browser does not support video.

Enter fullscreen mode Exit fullscreen mode

Feature 3: Support for graphics

  • Vector graphics is additionally an integral part of HTML5 like SVG and canvas.
  • HTML5 allows the drawing of shapes like circle, rectangle, triangle, etc.
  • It is supported by all-new browsers like Firefox, Mozilla, Chrome, Safari, etc.
<svg width="100" height="100">
     <circle cx="50" cy="50" r="40" fill="yellow" />

<canvas id="myCanvas" width="200" height="100" style="border:1px solid #000000;">
Enter fullscreen mode Exit fullscreen mode

Feature 4: Introduced semantic attributes

New elements for web structure like nav, header, footer, article, section, nav, aside, figure are introduced. The below example shows the usage of some semantic attributes.

      <h1>A heading here</h1>
      <p>Some subtitles here</p>
      <p>Some additional information here</p>
   <p>Lorem Ipsum dolor set amet....</p>
      <h2>Topic 1</h2>
      <p>Topic 1 details and more and more information</p>
      <p>Developed and Published</p>
          <a href="">
Enter fullscreen mode Exit fullscreen mode

Feature 5: Character encoding is simple and easy

Simply add one line and you are set.

<meta charset=“UTF-8”>
Enter fullscreen mode Exit fullscreen mode

Feature 6: Track GeoLocation

One can track the GeoLocation of a user easily by using JS GeoLocation API.

<!DOCTYPE html>
      <p>Click the button to get your coordinates.</p>
      <button onclick="getLocation()">Try It</button>
      <p id="demo"></p>
          var x = document.getElementById("demo");
          function getLocation() {
              if (navigator.geolocation) {
              } else {
             x.innerHTML = "Geolocation is not supported by this browser.";
          }          function showPosition(position) {
              x.innerHTML = "Latitude: " + position.coords.latitude + "<br>Longitude: " + position.coords.longitude;

Enter fullscreen mode Exit fullscreen mode

Feature 7: Uses application cache to store offline data.

<!DOCTYPE html>
         <div id="result"></div>
             // Check browser support
             if (typeof(Storage) !== "undefined") {
                  // Store
                  localStorage.setItem("lastname", "shah");
                  // Retrieve
                  document.getElementById("result").innerHTML =           localStorage.getItem("lastname");
             } else {
                  document.getElementById("result").innerHTML = "Sorry, your browser does not support Web Storage...";

Enter fullscreen mode Exit fullscreen mode

Feature 8: Supports calendar operations

Modern form elements like date, time, week, email, and many more are launched.

<input type="week" name="week" id="my-week" min="2020-W18" max="2020-W26" required>

Enter fullscreen mode Exit fullscreen mode

Miscellaneous features

  • Allows JavaScript to run in the background. This is possible due to the JS web worker API in HTML5. JS worker API is integrated into HTML5, and that’s the reason it can now run JavaScript within the web browser, instead of the browser interface thread
  • More mobile-friendly.
  • Capable of handling inaccurate syntax.
  • Supports async and ping attributes
  • Supports drag and drop effects.

I think the feature list can go on and on. But I hope with this article you can at least get some basic understanding of what’s new and supported with new evolving HTML5 language!

Many thanks for reading!

Top comments (0)