What are some possible reasons of HTML having <img> as a self-closing tag and <video> not as a self-closing tag?

HTML video tag - change source on viewport without media attribute

I'm trying to implement a video in HTML with react. So if the viewport is under 750px width, I would like to change the video source to a smaller resolution/ smaller file (because of high data transfer and so on).

I'm trying to implement a video in HTML with react. So if the viewport is under 750px width, I would like to change the video source to a smaller resolution/ smaller file (because of high data transfer and so on).

So in a perfect HTML world, you would build this:

<video controls> 
   <source src="video-small.mp4" type="video/mp4" media="all and (max-width: 750px)"> 
   <source src="video.mp4" type="video/mp4"> 
</video>

Since media is not (or no more) specified in the source tag if it's inside of a video tag, I can't use this anymore. Because Chrome is displaying the first source, which is the mobile video. No matter if desktop or mobile.

Second solution was to wrap a container around and set display: none; to the not visible video:

import React from 'react'
import PropTypes from 'prop-types'
import styled from 'styled-components'
import LazyLoad from 'react-lazyload'

const MobileVideo = styled.div width: 100%; height: 100%; object-fit: cover; display: none; ${({theme}) =&gt; theme.media.mobile
display: block;
}

const DesktopVideo = styled.div width: 100%; height: 100%; object-fit: cover; display: block; ${({theme}) =&gt; theme.media.mobile
display: none;
}

const VideoComponent = ({
srcWebm,
srcMp4,
mobileSrcWebm,
mobileSrcMp4,
poster,
className,
forwardedRef,
...rest
}) => (
<React.Fragment>
<MobileVideo>
<video
playsInline
poster={poster.url}
className={className}
ref={forwardedRef}
{...rest}
>
{mobileSrcWebm.url !== '' && (
<source src={mobileSrcWebm.url} type="video/webm" />
)}
{mobileSrcMp4.url !== '' && (
<source src={mobileSrcMp4.url} type="video/mp4" />
)}
</video>
</MobileVideo>
<DesktopVideo>
<video
playsInline
poster={poster.url}
className={className}
ref={forwardedRef}
{...rest}
>
{srcWebm.url !== '' && <source src={srcWebm.url} type="video/webm" />}
{srcMp4.url !== '' && <source src={srcMp4.url} type="video/mp4" />}
</video>
</DesktopVideo>
</React.Fragment>
)

In this case the correct video is displayed, but both videos are downloaded (in Chrome). Hiding doesn't prevent the browser from downloading. SAD!

Third solution was to use the second solution and remove the invisible component from the DOM:

import React from 'react'
import PropTypes from 'prop-types'
import styled from 'styled-components'
import LazyLoad from 'react-lazyload'

import {sizes} from '../../lib/ThemeProvider/media'

const MobileVideo = styled.div width: 100%; height: 100%; object-fit: cover; display: none; ${({ theme }) =&gt; theme.media.mobile
display: block;
}

const DesktopVideo = styled.div width: 100%; height: 100%; object-fit: cover; display: block; ${({ theme }) =&gt; theme.media.mobile
display: none;
}

class VideoComponent extends React.Component {
state = {
showMobileSrc: true
}

componentDidMount() {
this.resize()
window.addEventListener('resize', this.resize)
}

componentWillUnmount() {
window.removeEventListener('resize', this.resize)
}

resize = () => {
if (window.innerWidth >= sizes.mobile) {
this.setState({ showMobileSrc: false })
} else {
this.setState({ showMobileSrc: true })
}
}

render() {
const { srcWebm,
srcMp4,
mobileSrcWebm,
mobileSrcMp4,
poster,
className,
forwardedRef,
...rest
} = this.props
const {showMobileSrc} = this.state
return (
<React.Fragment>
{showMobileSrc && <MobileVideo>
<video
playsInline
poster={poster.url}
className={className}
ref={forwardedRef}
{...rest}
>
{mobileSrcWebm.url !== '' && (
<source src={mobileSrcWebm.url} type="video/webm" />
)}
{mobileSrcMp4.url !== '' && (
<source src={mobileSrcMp4.url} type="video/mp4" />
)}
</video>
</MobileVideo>}
{!showMobileSrc && <DesktopVideo>
<video
playsInline
poster={poster.url}
className={className}
ref={forwardedRef}
{...rest}
>
{srcWebm.url !== '' && <source src={srcWebm.url} type="video/webm" />}
{srcMp4.url !== '' && <source src={srcMp4.url} type="video/mp4" />}
</video>
</DesktopVideo>}
</React.Fragment>
)
}
}

But chrome is downloading both videos anyway. HTML seems to be correct. No idea what chrome is doing there..

First i really don"t understand why they removed the media attribute from the source tag inside of a video tag. Thats not consistently implemented.

Anyway: How can I change the source at a defined viewport width and prevent downloading both videos?

Download Instagram videos and photos using HTML, CSS and JavaScript

Download Instagram videos and photos using HTML, CSS and JavaScript

How can we download Instagram videos and photos using the HTML CSS JavaScript program? Solution: See this JavaScript Instagram Media Downloader. In other words, Program For Save Instagram Photos & Videos

Previous I have shared JS Random Password Generator for social media, but this is for download Instagram’s media. Basically, Instagram is the largest media sharing social platform in the world. And our idols and favorite celebrities are on this network. Sometimes we like any photos or videos and want to save it offline but, we can’t save or download Instagram media directly. Then we have to go a third-party website for download media, but we can create a program for that work.

Today you will learn to create a program for Save Insta Photos & Videos. Basically there is a text input field, a button, and a dummy image. When you will put a valid Instagram photo or video linked to the input field and click on the button then the image will visible by replacing the dummy image. After the image appearance, you click save it by right click on the mouse.

So, Today I am sharing JavaScript Instagram Media Downloader. This program is completely based on JavaScript, no other libraries used in there. The program getting the image or video and shows on the page and you can save it locally. Peoples search for Instagram downloader, you can take this script and use it your website to getting visitors.

If you are thinking now how this Instagram downloader actually is, then see the preview given below.

JavaScript Instagram Media Downloader Source Code

Before sharing source code, let’s talk about it. First I have created a header and a section using HTML. The header for placing the blank input and the button and the section for showing the image and massage. Also in the HTML file, I have linked the other files like JavaScript and CSS. HTML has very little part in this program, it just creating the layout and frame of the program.

Now using CSS, I have placed all the elements in the right place, as you can see in the preview. I just styled the header section and input fields, also I placed a dummy image in the image section by default. This a responsive design, for creating that I have used CSS @media query and resize the elements according to small screen size.

JavaScript doing here the main work of the program, the whole program is based on JS. There I have used JavaScript const statement in the whole program (info). There I have created 3 sections of codes, first for getting video, second for getting the image, and third for the printing media like photos and videos. In the JS file, I left comments on every section for easy understanding.

Left all other things you will learn after getting the codes, I can’t explain all in writing. For creating this program you have to create 3 files for that. First for HTML, second for CSS, and the third one for JavaScript. Follow the steps to creating this without any error.

index.html

Create an HTML file named ‘index.html‘ and put these codes given below.

<html lang="en" >
<head>
  <meta charset="UTF-8">
  <title>Instagram Downloader | Webdevtrick.com</title>
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <main>
    <header class="navbar">
      <input type="text" value="" placeholder="Paste link here...">
      <button class="search" onclick="getMedia()">Get</button>
    </header>
    <section class="result">
      <div class="image-placeholder"></div>
      <p> Copy image or video link from Instagram and put it on the field given on the top. </p>
    </section>
  </main>
  
  <script  src="function.js"></script>
 
</body>
</html>

style.css

Now create a CSS file named ‘style.css‘ and put these codes given here.

* {
  box-sizing: border-box;
}
html, body {
  position: relative;
  height: 100%;
}
body {
  margin: 0;
  padding: 0;
  font-family: "consolas",monospace;
  font-size: 14px;
  line-height: 1.5;
  background: #f9f9f9;
  color: #333;
}
code {
  background: #208bfd;
  color: #f9f9f9;
  padding: 0.1em 0.5em;
  border-radius: 4px;
}
.image-placeholder {
  margin: auto;
  width: 89%;
  max-width: 500px;
  display: block;
  height: 380px;
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center center;
  background-image: url(https://webdevtrick.com/wp-content/uploads/image-placeholder.png);
}
@media (max-width: 420px) {
  .image-placeholder {
    width: 320px;
    max-width: 320px;
    height: 280px;
    background-size: contain;
    background-position: top left;
    background-attachment: scroll;
  }
}
header {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4em;
  background: #208bfd;
  margin: 0 auto;
  text-align: center;
  color: #f9f9f9;
}
::placeholder {
  color: #212121;
}
input {
  display: inline-block;
  width: 100%;
  max-width: 50%;
  max-width: calc(100% - 8em);
  min-height: 2.8em;
  padding: 0.5em;
  margin: 0.5em 0;
  background: #f3f3f3;
  border-color: #208bfd;
  border-width: 1px;
  color: #212121;
  transition: all 500ms ease;
}
input:focus, input:hover {
  border-color: #208bfd;
  transition: all 500ms ease;
}
 
@media (min-width: 420px) {
  input {
    max-width: 50%;
  }
}
.search {
  display: inline-block;
  padding: 0 1em;
  text-align: center;
  min-width: 2.8em;
  height: 2.8em;
  margin: 0;
  background: #208bfd;
  border: 2px solid #212121;
  color: #f9f9f9;
  transition: all 500ms ease;
}
.search:focus, .search:hover {
  background: #212121;
  border-color: #f9f9f9;
  cursor: pointer;
  transition: all 500ms ease;
}
.result {
  margin: 0 auto;
  padding: 4em 1em;
  max-width: 40em;
}
.result video, .result img {
  width: calc(100% - 4em);
  margin: 2em;
}
.result .download {
  text-decoration: none;
  display: inline-block;
  padding: 0.5em 1em;
  background: #208bfd;
  border-color: #208bfd;
  border-width: 1px;
  color: #f9f9f9;
  transition: all 500ms ease;
}
.result .download:focus, .result .download:hover {
  background: #208bfd;
  border-color: #f9f9f9;
  cursor: pointer;
  transition: all 500ms ease;
}
@media (max-width: 600px) {
  .result {
    position: absolute;
    top: 4em;
    left: 0;
    right: 0;
    height: calc(100% - 10em);
    overflow-y: auto;
    max-width: 40em;
    background: #f9f9f9;
    margin: auto;
  }
}
footer {
  width: 100%;
  margin: 2em auto;
  text-align: center;
}
 
@media (max-width: 600px) {
  footer {
    position: absolute;
    bottom: 1em;
    left: 0;
    right: 0;
    height: 2em;
  }
}

function.js

The final step, Create a JavaScript file named ‘function.js‘ and put the codes.

const _ = e => document.querySelector(e);
const render = _('.result');
 
 
// create video
const createVideo = data => {
  let v = document.createElement('video');
  v.id = "instavideo";
  v.src = data.content; 
  v.controls = true;
  v.autoplay = true;
 
  // create info
  let info = document.createElement('p');
  info.textContent = "Click the right button on video and select save as.";
 
  render.innerHTML = ""; 
  render.appendChild(v);
  render.appendChild(info);
};
// create image
const createImg = data => {
  // create image
  let i = document.createElement('img');
  i.id = "instaImg";
  i.src = data.content;
 
  // create info
  let info = document.createElement('p');
  info.textContent = "Click the right button on the image and select save image..";
 
  render.innerHTML = ""; 
  render.appendChild(i); 	
  render.appendChild(info); 
 
};
 
// extract html
const getMedia = () => {
  render.innerHTML = "<div class='image-placeholder'></div>";
  // get input value
  let url = _('input').value;
  if (url) {
    fetch(url).
    then(r => r.text()).
    then(r => {
      // render html
      render.innerHTML = r;
      // wait, find meta and create video or image
      let w = setTimeout(() => {
        let v = _('meta[property="og:video"]');
        if (v) {
          createVideo(v);
        } else {
          let img = _('meta[property="og:image"]');
          if (img) {
            createImg(img);
          } else {
            document.body.innerHTML = body;
            alert('Error extracting Instagram image / video.');
          };
        }
        clearTimeout(w);
      }, 200);
    });
  } else {
    _('input').setAttribute('placeholder', 'Invalid address, use a proper Insagram link');
 
  }
};

That’s It. Now you have successfully created JavaScript Instagram Media Downloader, Save Insta Photos & Videos Program. If you have any doubt or questions comment down below.

Thanks for reading. I'm highly appreciate your actions! Please share if you liked it!

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!