Interview Questions

HTML5

HTML5 Header, Footer and Article Elements

Header Element:
Header element is used to represent the Header of a section mainly for headings and subheadings.

Footer Element:
Footer element is used to capture the footer of a section.
Example: Capturing the Copyright details.

Article Element:
Article element represents the content of the document like Blog entry, comments, data, article etc

<html>
<head>
<title>HTML5 Header, Footer and Article Element Demo</title>
</head>

<body>
<header>
<h1>Techdive Demo</h1>
</header>

<article>
<p>Deep Dive in to Technology</p>

HTML5 Canvas

Canvas is used for rendering Graphs, graphics and other visual images

Global Attributes:

width
height

Example:

<!DOCTYPE html>
<html>

<head>
<title>Canvas Demo</title>
</head>

<body>

<canvas id="techDiveDemoCanvas" width="200" height="200" style="border:1px solid red">
HTML5 Canvas Not Supported
</canvas>

<script>
    var canvasElement = document.getElementById("techDiveDemoCanvas");
    var context = canvasElement.getContext("2d");
    context.fillRect(0, 0, 150, 100);
</script>

</body>

HTML5 Video

The video element represents the video stream.

Global Attributes:

src
poster
autobuffer
autoplay
loop
controls
width
height

Example:

<!DOCTYPE html>
<html>

<head>
<title>Play sample Video File</title>
</head>

<body>
<!-- Logic to play the Video file -->
<video  height="300" width="300" src="TDD.mp4" controls />
</body>
</html>

HTML5 Audio

The audio element represents the audio or sound stream.

Global Attributes:

src
autobuffer
autoplay
loop
controles

Example:

<!DOCTYPE html>
<html>

<head>
<title>Play sample Audio File</title>
</head>

<body>
<!-- Logic to play the Audio file -->
<audio controls>
  <source src="TDD.mp3" type="audio/mpeg">
</audio>
</body>
</html>

A Simple HTML5 Page

<!DOCTYPE html>
<html>
 <head>
  <title>Sample Home Page</title>
 </head>
 <body>
  <!-- HTML5 Sample page Demo – This is Comment -->
  <h1> Sample Home Page</h1>
  <p>Welcome to HTML5 Tutorial :)</p>
 
 </body>
</html>

HTML5 Tutorial

Hyper Text Markup Language was primarily designed in the initial days as a language for sematically desribe the sientific documents.

HTML5 is the new standard for HTML and published by World Wide Web Consortium (W3C) group.

Features:
1. Has in built capability to play audio and video formats. Eg., <audio>, <video>. The usage of Flash player and other video pluggins are not required
2. Introduction of <Canvas> Element for drawing 2D diagrams

HTML5 - Basic Form Validation

The following code illustrates basic form validation using HTML5

<!DOCTYPE html>
<html>
<body>
<section>
<hgroup>
<h1>Demo</h1>
<p>Registration</p>