Ayan Choudhury
Founder & CEO - TheoreX | Startup Enthusiast | Open Source Enthusiast | Wikimedian | Mozillian
Text
<! DOCTYPE HTML>
<!DOCTYPE html>
<meta charset-UTF-8>
<title>Page Title</title>
<p>Look at my Sloppy Code!</p>
For Better Structure
<section>
<article>
<nav>
<hgroup>
<header>
<footer>
<address>
<figure>
<figcaption>
<small>
<cite>
<time datetime pubdate>
<time datetime pubdate>
<time datetime pubdate>
<time datetime="2015-03-25">March 25</time>
<p>I usually have a snack at
<time>16:00</time>.</p>
<article>
<h1>Small Tasks</h1>
<footer>
published <time pubdate>2009-08-30</time>
</footer>
<p>I put a bike bell on his bike.</p>
</article>
<mark>
<canvas>
<canvas>
<canvas width="400" height="150"></canvas>
< ! - - provide alternative contents - - >
<canvas id="clock" width="150" height="150">
<img src="img/clock.png" width="150" height="150" alt="clock">
</canvas>
//Reference the canvas object
var canvas = document.getElementByID ('clock');
//check for support
if (canvas.getContext)
{
//Get the context
var context = canvas.getContext ('2d');
}
<canvas>
<!DOCTYPE html>
<canvas id="myCanvas" width="200" height="100" style="border:1px solid #c3c3c3;">
Your browser does not support the canvas element.
</canvas>
<script>
var canvas = document.getElementById("myCanvas");
var ctx = canvas.getContext("2d");
ctx.fillStyle = "#FF0000";
ctx.fillRect(0,0,150,75);
</script>
<video>
<video>
<!DOCTYPE html>
<video width="320" height="240" autoplay>
<source src="movie.mp4" type="video/mp4">
<source src="movie.ogg" type="video/ogg">
Your browser does not support the video tag.
</video>
<video>
<!--Basic Embedding-->
<video src="somefile.ogv"></video>
<!--Specify video dimensions and enable controls-->
<video src="somefile.ogv" height="240" width="400" controls></video>
<!--Video will start downloading (but not playing) as soon as the page loads-->
<video src="somefile.ogv" height="240" width="400" preload></video>
<!--Enable Autoplay-->
<video src="somefile.ogv" height="240" width="400" autoplay></video>
<input type=email>
<input type=url>
<input type=date>
Date / time related input types
<!--for calendar date pickers-->
<input type="date">
<!--for months-->
<input type="month">
<!--for weeks-->
<input type="week">
<!--for timestamps-->
<input type="timestamps">
<!--for precise/absolute date, timestamps-->
<input type="datetime">
<!--for local dates and times-->
<input type="datetime-local">
<input type=number>
<input type=range>
Renders as a slider
Used to be Javascript driven elements, but now the responsibility of creating accessible sliders is moved from developers to browsers vendors.
<input type=tel>
Expects a telephone number
Doesn't enforce numeric only input
<input type=color>
Allows the user to input a color value via a picker
Current support is very limited
The list Attribute
The list Attribute
<input id="salutation" type="text" list="salutation">
<datalist id="salutations">
<option label="Mr" value="Mr">
<option label="Ms" value="Ms">
<option label="Prof" value="Professor">
</datalist>
@technoayan
By Ayan Choudhury
HTML5 for beginners
Founder & CEO - TheoreX | Startup Enthusiast | Open Source Enthusiast | Wikimedian | Mozillian