The Complete HTML5 Course 2018 From Beginning to Advanced

HTML vs HTML5 - What's the Difference?

HTML vs HTML5 - What's the Difference?

This comparison on HTML vs HTML5 is intended to provide a crisp knowledge about both the markup languages and guide you to find the suitable one if you are building your own web page or web application.

This comparison on HTML vs HTML5 is intended to provide a crisp knowledge about both the markup languages and guide you to find the suitable one if you are building your own web page or web application.

History of HTML

The history of the hypertext markup language is a strange and interesting tale. The man behind HTML, Tim Berners-Lee was putting together his first elementary browsing and authoring system for the Web and created a quick little hypertext language that would serve his purposes.

But the problem lied in the simplicity of the language. HTML was text-based and anyone could use any editor or word processor to create or convert documents for the Web. The developers started implementing new features in their browsers and started releasing advanced versions of HTML.

Introduction to HTML & HTML5

HTML stands for Hyper Text Markup Language and it is the standard markup language for creating web pages and web applications. It is used to describe the structure of Web pages using markup.

HTML5 is the 5th version of HTML and is a core technology markup language of internet that is used for structuring and presenting the content for www.

Comparison between the Two

Now lets have a look at all the new elements that were added in HTML5 and the factors that make it better than HTML.

Let’s look at the factors we will be using for the comparison on HTML vs HTML5:
Video & AudioVector GraphicsStorageWeb Browser SupportEase of Use

Video & Audio

The first factor in HTML vs HTML5 is the introduction of audio and video in HTML5. There was no such concept of media in case of HTML. But it is one of the integral part of the 5th Version.

Vector Graphics

Vector graphics was used in HTML with the help of various technologies such as VML, Flash, Silverlight etc. But it is an integral part of HTML 5 such as canvas and svg. This was a new addition to the revised version.

Storage

The third factor of comparison is storage. In case of HTML, we can use the browser cache as the temporary storage whereas in case of HTML5, **application cache, web SQL database **and web storage is used.

Web Browser Support

Now for the first version of HTML, all the old web browsers run smoothly for creating web pages. For HTML5, the new browsers have started supporting its specifications. Some of the browsers include mozilla firefox, chrome, opera etc.

Ease of Use

While HTML5 does have risks like** constant updates**, it is generally easy to keep up with the changes and updates because of the simpler syntax as compared to other versions of HTML. For instance, you have a very simple declaration at the start of the page to set it as an HTML5 page, ie, the doctype declaration.

New Elements in HTML5

The comparison on HTML vs HTML5 also includes new elements and tags that have been added to the latest version. HTML5 comes with a number of new elements and eliminates several others. Some of the tags were discarded in the new HTML version and the usage of tags were changed accordingly.

Let’s have a look at some of the important tags that were added in HTML5:

Audio & Video

The **audio tag **and the video tag are the two major additions to the HTML5. The audio tag and the video tag enables developers to embed music and audio on their website.The audio & video tags also have a number of attributes for additional controls.

<audio autoplay=”autoplay” controls=”controls”>
<source src=”music.ogg” />
<source src=”music.mp3″ />
</audio>

There are a few other multimedia attributes and elements that come with HTML5, like the track element that provides text tracks for the video element.

Canvas

One of the key added elements in HTML5 is which has hugely impacted the use of Adobe Flash in websites. The element can be used to draw graphics with various shapes and colors via scripting, usually JavaScript. The element is simply a container for the graphics.

<canvas id=”myCanvas” width=”200″ height=”100″ style=”border:1px solid #000000;”>
</canvas>

Header > & < Footer

Another big addition that HTML5 comes with are the new and elements, indicating a new web anatomy. With these new tags, there is no longer a need to identify the two elements with a

tag.

<header>
<h1>Title </h1>
<div class=”post-meta”>
<p>By Author</a> <span class=”category”>Filed in Web 2.0</span></p>
</div>
</header>
<article>
<p>Body of text</p>
</article>

The footer is placed at the bottom of the web page but it can also be placed at the end of a page section.

<header>
<h1>Title </h1>
<div class=”post-meta”>
<p>By Author</a> <span class=”category”>Filed in Web 2.0</span></p>
</div>
</header>
<article>
<p>Body of text</p>
</article>

Menu

Given the fact that the web has changed into more just linked paged and documents, the tag is a welcome addition for greater web interactivity. It represents menu commands for simplicity in desktop and mobile applications.

<body contextmenu=”new-context-menu”>

<menu id=”new-context-menu” type=”context”>

<menuitem>Hello World</menuitem>

</menu>

</body>

Now with this, we come to an end of this comparison on HTML vs HTML5. I Hope you guys enjoyed this article and understood the difference between the two versions and how HTML5 is better and simpler in use. So, if you have read this, you might have a clear idea about which version of HTML you should opt for, while building your own web page.

Understanding of Meter Tag in HTML 5

Understanding of Meter Tag in HTML 5

This post explains the HTML 5 meter tag and how to create it

What is the meter tag?

I this article I am explaining the meter tag. The output of both (progress and meter) tags is the same as we will see but there is the difference that actually the meter tag is used to represent a scalar measurement within a known range. The value can be fractional.Examples

Disk uses, the relevance of a query result, the fraction of a voting population to have selected a specific candidate.

What is the difference between the progress tag and the meter tag? Progress bar is used to display the progress of a specific task. Or a progress element represents the completion progress of a task. Whereas the meter tag is used to represent guages.  We can think that a progress tag represents dynamic data whereas a meter tag represents static data.

Note:

  1. According to the W3C, the meter element should not be used to indicate progress, because to indicate the progress we have the progress tag.
  2. The meter element also does not represent a scalar value of an arbitrary range; for example, it would be wrong to use this to report a weight, or height, unless there is a known maximum value.

Syntax

The Meter tag is an inline element, the same as a header, progress and so on.

Attributes

<meter></meter>   

Apart from the Global Attributes and Event Attributes, the meter tag have 6 more attributes as shown in the following table:

The following inequalities must hold, as applicable:

  • min <= value <= max
  • min <= low <= max (if low is specified)
  • min <= high <= max (if high is specified)
  • min <= optimum <= max (if optimum is specified)
  • low <= high (if both low and high are specified)

Note: if you do not specify min or max then the range will be between 0.0 to 1.0 and the value must be in that range.

HTML DOM Meter Object

In the DOM the meter element is defined by METER that represents for HTML 5.

  • How the meter object can be accessed: using the getElementById() method you can access the element.
var x = document.getElementById("[Give id of the meter tag here]");  
  • Create a meter object: You can also create the element dynamically using the createElement() method:
var x = document.createElement("METER");    
  • Meter object properties: The properties of a meter object are given in the following table:

Example 1: This example will show you how can you use a meter element in HTML 5.

<!DOCTYPE html>        
<html lang="en">        
<head>        
    <meta charset="utf-8" />        
</head>        
<body>        
   <b>Meter without value</b>    
   <meter></meter>    
    
   <br/><br/>    
   <b>Meter with value but without min and max attribute</b>    
   <meter value="0.8"></meter>    
    
   <br/><br/>    
   <b>Meter with value, min and max attribute</b>    
   <meter min="0" max="100" value="17"></meter>    
    
   <br/><br/>    
   <b>Meter (when "min <= value < low")</b>    
   <meter  min="0" max="100" value="17" low="25" high="75"></meter>    
    
   <br/><br/>    
   <b>Meter (when "high < value <= max")</b>    
   <meter  min="0" max="100" value="80" low="25" high="75"></meter>    
    
   <br/><br/>    
   <b>Meter (when "low <= value <= high")</b>    
   <meter  min="0" max="100" value="50" low="25" high="75"></meter>    
    
   <br/><br/>    
   <b>Meter with optimum attribute</b>    
   <meter  min="0" max="100" value="24" low="25" high="75" optimum="80"></meter>    
    
   <br/><br/>    
   <b>Meter with optimum attribute</b>    
   <meter  min="0" max="100" value="80" low="25" high="75" optimum="20"></meter>    
    
</body>        
</html>     

The output of example 1:

Styling meter element: we can define various types of styles for the meter element using a progress selector.Example 2: This example will explain how to increase the width and height of a meter element.

Example 2: This example will explain how to increase the width and height of a meter element.

<!DOCTYPE html>        
<html lang="en">        
<head>        
    <meta charset="utf-8" />     
   <style>    
   meter {    
     width: 400px;    
     height: 25px;    
   }    
   </style>       
</head>        
<body>        
   <b>Meter without value</b>    
   <meter></meter>    
    
   <br/><br/>    
   <b>Meter with value but without min and max attribute</b>    
   <meter value="0.8"></meter>    
    
   <br/><br/>    
   <b>Meter with value, min and max attribute</b>    
   <meter min="0" max="100" value="17"></meter>    
       
   <br/><br/>    
   <b>Meter (when "min <= value < low")</b>    
   <meter  min="0" max="100" value="17" low="25" high="75"></meter>    
    
   <br/><br/>    
   <b>Meter (when "high < value <= max")</b>    
   <meter  min="0" max="100" value="80" low="25" high="75"></meter>    
    
   <br/><br/>    
   <b>Meter (when "low <= value <= high")</b>    
   <meter  min="0" max="100" value="50" low="25" high="75"></meter>    
    
   <br/><br/>    
   <b>Meter with optimum attribute</b>    
   <meter  min="0" max="100" value="24" low="25" high="75" optimum="80"></meter>    
    
   <br/><br/>    
   <b>Meter with optimum attribute</b>    
   <meter  min="0" max="100" value="80" low="25" high="75" optimum="20"></meter>    
    
</body>        
</html>     

Output of the Example 2:

More in styling:

  • WebKit/Blink Browser: like Opera, Googe Chrome and Safari
  • FireFox
  • Internet Explorer

1. WebKit/Blink Browser: According to webkit.org, we can have 5 different pseudo classes that are given in the following table.

Example 3:  This example explains how to reset the appearance of a meter element. To reset the appearance we use -webkit-appearance:none;

<!DOCTYPE html>          
<html lang="en">          
<head>          
    <meta charset="utf-8" />       
<style>      
meter {      
  width: 300px;      
  height: 25px;      
  -webkit-appearance: none; /* Reset appearance */      
  border: 1px solid #ccc;      
  border-radius: 5px;      
}      
</style>         
</head>          
<body>          
<b>Meter without value</b>      
<meter></meter>      
      
<br/><br/>      
<b>Meter with value but without min and max attribute</b>      
<meter value="0.8"></meter>      
      
<br/><br/>      
<b>Meter with value, min and max attribute</b>      
<meter min="0" max="100" value="17"></meter>      
      
<br/><br/>      
<b>Meter (when "min <= value < low")</b>      
<meter  min="0" max="100" value="17" low="25" high="75"></meter>      
      
<br/><br/>      
<b>Meter (when "high < value <= max")</b>      
<meter  min="0" max="100" value="80" low="25" high="75"></meter>      
      
<br/><br/>      
<b>Meter (when "low <= value <= high")</b>      
<meter  min="0" max="100" value="50" low="25" high="75"></meter>      
      
<br/><br/>      
<b>Meter with optimum attribute</b>      
<meter  min="0" max="100" value="24" low="25" high="75" optimum="80"></meter>      
      
<br/><br/>      
<b>Meter with optimum attribute</b>      
<meter  min="0" max="100" value="80" low="25" high="75" optimum="20"></meter>      
      
</body>          
</html>      

Output of the Example 3:

Example 4: How to render the background container?

According to the preceding table I have described that we can render the container using the -webkit-meter-bar pseudo-class, so to apply the rendering I am using the following code:

meter::-webkit-meter-bar {    
  background: none;     
  background-color: whiteSmoke;    
  box-shadow: 0 5px 5px -5px #00F inset;    
  border: 1px solid #0ff;    
  border-radius: 5px;    
}  

Complete Code

<!DOCTYPE html>        
<html lang="en">        
<head>        
    <meta charset="utf-8" />     
<style>    
meter {    
  width: 300px;    
  height: 25px;    
  -webkit-appearance: none; /* Reset appearance */    
  border: 1px solid #F0f;    
  border-radius: 5px;    
}    
meter::-webkit-meter-bar {    
  background: none;     
  background-color: whiteSmoke;    
  box-shadow: 0 5px 5px -5px #00F inset;    
  border: 1px solid #0ff;    
  border-radius: 5px;    
}    
    
</style>       
</head>        
<body>        
<b>Meter without value</b>    
<meter></meter>    
    
<br/><br/>    
<b>Meter with value but without min and max attribute</b>    
<meter value="0.8"></meter>    
    
<br/><br/>    
<b>Meter with value, min and max attribute</b>    
<meter min="0" max="100" value="17"></meter>    
    
<br/><br/>    
<b>Meter (when "min <= value < low")</b>    
<meter  min="0" max="100" value="17" low="25" high="75"></meter>    
    
<br/><br/>    
<b>Meter (when "high < value <= max")</b>    
<meter  min="0" max="100" value="80" low="25" high="75"></meter>    
    
<br/><br/>    
<b>Meter (when "low <= value <= high")</b>    
<meter  min="0" max="100" value="50" low="25" high="75"></meter>    
    
<br/><br/>    
<b>Meter with optimum attribute</b>    
<meter  min="0" max="100" value="24" low="25" high="75" optimum="80"></meter>    
    
<br/><br/>    
<b>Meter with optimum attribute</b>    
<meter  min="0" max="100" value="80" low="25" high="75" optimum="20"></meter>    
    
</body>        
</html>     

Output of the Example 4:

Example 5: This example explains how to render the value of the meter element, it means inside the container how to apply the rendering.

According to the table we can render the meter elements using the following pseudo classes:

-webkit-meter-optimum-value  
-webkit-meter-suboptimum-value  
-webkit-meter-even-less-good-value  

Code: I am using the following code:

  1. For -webkit-meter-optimum-value:
meter::-webkit-meter-optimum-value {    
  box-shadow: 0 5px 5px -5px #999 inset;    
  background-image: linear-gradient(    
    25deg,     
    #002900 5%,     
    #003D00 5%,    
    #005200 25%,    
    #007A00 25%,    
    #00A300 55%,    
    #00CC00 55%,    
    #33D633 95%,    
    #66E066 95%,    
    #99EB99 100%    
  );    
  background-size: 100% 100%;    
}   
  1. For -webkit-meter-suboptimum-value:
meter::-webkit-meter-suboptimum-value {    
  box-shadow: 0 5px 5px -5px #999 inset;    
  background-image: linear-gradient(    
    25deg,     
    #333300 5%,     
    #666600 5%,    
    #999900 25%,    
    #CCCC00 25%,    
    #FFFF00 55%,    
    #FFFF33 55%,    
    #FFFFCC 95%,    
    #FF3300 95%,    
    #B22400 100%    
  );    
  background-size: 100% 100%;    
}   
  1. For -webkit-meter-even-less-good-value:
meter::-webkit-meter-even-less-good-value  {    
  box-shadow: 0 5px 5px -5px #999 inset;    
  background-image: linear-gradient(    
    25deg,     
    #000000 5%,     
    #330000 5%,    
    #660000 25%,    
    #990000 25%,    
    #CC0000 55%,    
    #FF0000 55%,    
    #FF3333 95%,    
    #FF6666 95%,    
    #FF9999 100%    
  );    
  background-size: 100% 100%;    
}   

Complete Code:

<!DOCTYPE html>        
<html lang="en">  
   <head>  
      <meta charset="utf-8" />  
      <style>    
         meter {    
         width: 300px;    
         height: 25px;    
         -webkit-appearance: none; /* Reset appearance */    
         border: 1px solid #F0f;    
         border-radius: 5px;    
         }    
         meter::-webkit-meter-bar {    
         background: none;     
         background-color: whiteSmoke;    
         box-shadow: 0 5px 5px -5px #00F inset;    
         border: 1px solid #0ff;    
         border-radius: 5px;    
         }    
         meter::-webkit-meter-optimum-value {    
         box-shadow: 0 5px 5px -5px #999 inset;    
         background-image: linear-gradient(    
         25deg,     
         #002900 5%,     
         #003D00 5%,    
         #005200 25%,    
         #007A00 25%,    
         #00A300 55%,    
         #00CC00 55%,    
         #33D633 95%,    
         #66E066 95%,    
         #99EB99 100%    
         );    
         background-size: 100% 100%;    
         }    
         meter::-webkit-meter-suboptimum-value {    
         box-shadow: 0 5px 5px -5px #999 inset;    
         background-image: linear-gradient(    
         25deg,     
         #333300 5%,     
         #666600 5%,    
         #999900 25%,    
         #CCCC00 25%,    
         #FFFF00 55%,    
         #FFFF33 55%,    
         #FFFFCC 95%,    
         #FF3300 95%,    
         #B22400 100%    
         );    
         background-size: 100% 100%;    
         }    
         meter::-webkit-meter-even-less-good-value  {    
         box-shadow: 0 5px 5px -5px #999 inset;    
         background-image: linear-gradient(    
         25deg,     
         #000000 5%,     
         #330000 5%,    
         #660000 25%,    
         #990000 25%,    
         #CC0000 55%,    
         #FF0000 55%,    
         #FF3333 95%,    
         #FF6666 95%,    
         #FF9999 100%    
         );    
         background-size: 100% 100%;    
         }    
      </style>  
   </head>  
   <body>        
      <b>Meter without value</b>    
      <meter></meter>    
      <br/><br/>    
      <b>Meter with value but without min and max attribute</b>    
      <meter value="0.8"></meter>    
      <br/><br/>    
      <b>Meter with value, min and max attribute</b>    
      <meter min="0" max="100" value="17"></meter>    
      <br/><br/>    
      <b>Meter (when "min <= value < low")</b>    
      <meter  min="0" max="100" value="17" low="25" high="75"></meter>    
      <br/><br/>    
      <b>Meter (when "high < value <= max")</b>    
      <meter  min="0" max="100" value="80" low="25" high="75"></meter>    
      <br/><br/>    
      <b>Meter (when "low <= value <= high")</b>    
      <meter  min="0" max="100" value="50" low="25" high="75"></meter>    
      <br/><br/>    
      <b>Meter with optimum attribute</b>    
      <meter  min="0" max="100" value="24" low="25" high="75" optimum="80"></meter>    
      <br/><br/>    
      <b>Meter with optimum attribute</b>    
      <meter  min="0" max="100" value="80" low="25" high="75" optimum="20"></meter>    
   </body>  
</html> 

Output of the Example 5:

2. FireFox Browser: For the FireFox browser use "-moz" instead of "-webkit" and everything else is the same.

3. Internet Explorer: In IE you can use all these properties directly, like appearance.

Thank you for reading ! I hope this tutorial will surely help!

Learn HTML5 Canvas - DRAW - HTML & JavaScript

Learn HTML5 Canvas - DRAW - HTML & JavaScript

We go over the basics of the HTML5 Canvas element and use JavaScript to draw lines, circles, squares and rectangles to the DOMs Canvas. JavaScript combined with HTML5 Canvas can be used to draw elements anywhere you want inside of the HTML5 Canvas. We learn the basics in a simple how to video but in the next part we will look how to animate the HTML5 Canvas using JavaScript to change the X & Y coordinates of shapes we create. We will follow an Object Oriented Programming pattern.