3.
HTML 5 – Gaining interest to become a Trend
Today’s designers when asked about HTML5 do hesitate to answer because of the lack
of knowledge about HTML5.
Also many times a question arises in many people’s mind that what’s the difference
between HTML and HTMl5. Many people think it’s just the updated version of HTML. This
is also just due to the lack of knowledge about HTML5.
Before discussing about HTML5, let’s have a look at some of the wrong notions about it.
3

4.
HTML 5 – Gaining interest to become a Trend
Many people think why we shall use HTML5 if it isn’t working on the old version
browsers?
1
2
4
Yes, that’s true that HTML5 is not supported by older versions of browsers, but instead of using
HTML5 for the complete website, you can at least use some features of it. You may not get support
for HTML5 but cavn get support for some of it features.
While thinking of HTML, the first thing that comes in your mind is a variety of tags and after
that the‘< >’brackets.
That’s a truth that HTML is made up of this tags and‘< >’brackets only but HTML5 gives an in depth meaning
of this‘< >’brackets as well as tags. HTML5 defines the interaction of this‘< >’brackets with the JavaScript
through DOM (Document Object Model).
3 People think that lets redesign our website with HTML5. But then due to lack of knowledge,
they don’t use it. But actually you don’t need to do so. You can use that old HTML with
HTML5.
No one would disagree on this that HTML is the best markup language ever. And HTML5 is built on that
HTML only with some more features. So it does support the features and will work well on the website
developed on HTML.
4 Is it very easy to get started with HTML5?
Yes, it is very easy to get started with HTML5. HTML supported many different types of DOCTYPE but HTML5
just supports one i.e. <!DOCTYPE html>
Whether you want to draw on a canvas, play video, design better forms, or build web applications that work
offline, you’ll find that HTML5 is already well-supported. Firefox, Safari, Chrome, Opera, and mobile brows-
ers already support canvas, video, geolocation, local storage, and more. Google already supports micro data
annotations. Even Microsoft — rarely known for blazing the trail of standards support — supports most
HTML5 features in Internet Explorer 9.
Now after discussing about the wrong notions let’s discuss about what is HTML5 and why was it required to
be developed.
HTML5 is a result of the co-operation between the W3C (World Wide Web Consortium) working on XHTML
and WHATWG (Web Hypertext ApplicationTechnology Working Group) working on web forms and applica-
tions. Its core aim is to improve the language that supports multimedia easily without using the scripting.

5.
Reasons why HTML5 was developed are:
HTML 5 – Gaining interest to become a Trend
5
Reduce the requirement of external plugins.
Better error handling.
Such markup that replaces the difficult scripting. After reasons, let’s come upon the new features that were
introduced in HTML5 are:
New Markup
New API’s
Support for local storage
Error Handling
Now let’s look at each and every feature in detail. Let’s start with
New Markup.
In HTML5, many tags deprecated in HTML are removed like <font>, <center>, <dir>, <frame>, etc.
Some many common blocks for which <div> tag was to be used, now is developed using the tags named
after the name of the block. Like for footer i.e. the bottom of each and every webpage can now be written
in <footer> tag. And this tags are also called as Structural tags.
For playing an audio or displaying a video, we used <object> tag but now we have individual tags for both
playing an audio and displaying a video i.e. <audio> and <video> tag respectively.
Some new form tags are also introduced like <datalist>, <keygen>, <output>, etc.
The <canvas> tag for immediate mode 2D drawing.
After discussing on the new markups designed, let’s discuss upon the
New API’s introduced in HTML5.
Timed media playback
Offline Web Applications
Document editing
Drag-and-drop
Cross-document messaging
Browser history management
MIME type and protocol handler registration
Micro data

6.
HTML 5 – Gaining interest to become a Trend
So this was a nut shell of the whole HTML5 and its features but you wouldn’t like it if I just listed the features. So
I won’t disappoint you. Here is the detail description about each and every markup designed or API introduced.
6
Web Storage, a key-value pair storage framework that provides behavior similar to cookies but with larger
storage capacity and improved API.
Scalable Vector Graphics
GeoLocation - The most important API introduced.

8.
3D graphics , effects and HTML5
<svg> element
SVG RECTANGLE: <rect> tag
8
Canvas with JavaScript is used to draw lines, circles, to write text, to show gradients, and to show images in
the canvas.
SVG stands for Scalable Vector Graphics.
SVG is a vector graphics format based on XML means SVG is an XML language, similar to XHTML, which can
be used to draw graphics.
SVG images and their behaviors are defined in XML file. As XML, SVG files can be created and edited in text
editors.
SVG can be used to develop lines, shapes, animated objects, to write text, etc.
It can be used to create an image either by specifying all the lines and shapes necessary, by modifying
already existing raster images, or by a combination of both.
The image and its components can also be transformed, composited together, or filtered to change its
appearance completely.
SVG supports some predefined shapes in the form of elements. They are:
To create a rectangle we use <rect > tag.
Syntax: <svg xlmns =“http://www.w3.org/2000/svg”version=”1.1”> </svg>
Rectangle <rect>
Circle <circle>
Ellipse <ellipse>
Line <line>
Polyline <polyline>
Polygon <polygon>
Path <path>

10.
3D graphics , effects and HTML5
10
SVG CIRCLE: <circle> tag
<!DOCTYPE html>
<html>
<head>
<title> Simple Circle </title>
</head>
<body>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<circle cx="200" cy="200" r="50" style="fill:rgb(0,255,0);" />
</svg>
</body>
</html>
width and height : Defines the dimensions of the rectangle.
CSS fill : used to fill color in the rectangle.
CSS stroke : used to define the color of the border.
CSS stroke – width: used to define the width of the border.
CSS fill – opacity: used to provide opacity (transparency) to the color filled in the rectangle.
CSS stroke – opacity: used to provide opacity (transparency) to the color of the border in the rectangle.
x and y: defines the position of the rectangle on the web browser.
The attributes of the <rect> tag are:
To create a circle we use <circle > tag.
Example of a Simple Circle.
Output :

11.
3D graphics , effects and HTML5
11
SVG ELLIPSE: <ellipse> tag
<!DOCTYPE html>
<html>
<head>
<title> Simple Ellipse Example </title>
</head>
<body>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<ellipse cx="100" cy="100" rx="50" ry="75" />
</svg>
</body>
</html>
cx and cy: These attributes are defined to set the center of the circle.
r: It defines the radius of the circle.
CSS fill: used to fill color in the circle.
CSS stroke: Used to define the color of the border around the circle.
CSS stroke-width: Used to define the width of the border around the circle.
The attributes that can be used with <circle> tag are:
To create an ellipse we use <ellipse > tag.
Example of a Simple Ellipse.
Output :

12.
3D graphics , effects and HTML5
12
SVG LINE: <line> tag
<!DOCTYPE html>
<html>
<head>
<title> Simple Line </title>
</head>
<body>
<svg xmlns="htp://www.w3.org/2000/svg" version="1.1">
<line x1="100" y1="120" x2="175" y2="195" style="stroke:rgb(10,100,50);
stroke-width:6" />
</svg>
</body>
</html>
To create a line we use <line> tag.
Example of a Simple Line.
cx and cy: These attributes define the center of the ellipse.
rx and ry: These attributes define the radius of the ellipse in horizontal as well as vertical direction respectively.
CSS fill: Used to fill the color in ellipse. By default the color is black.
CSS stroke: Used to define the color of the border around the ellipse.
CSS stroke – width: Used to define the width of the border around the ellipse.
The attributes used with <ellipse> tag are:
Output :

13.
3D graphics , effects and HTML5
13
<!DOCTYPE html>
<html>
<head>
<title> SImple Polygon </title>
</head>
<body>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<polygon points="100,140,110,190,210,200,260,240"
x1 and y1: They define the initial or the starting point of the line.
x2 and y2: They define the end point of the line.
Also you can define as many points you want to.
CSS stroke: This attribute is compulsory in case of line as if you don’t define stroke it will by default take the color of
the line as white and the output will be something like this.
CSS stroke-width: This attribute is used to define the width of the line.
The attributes used with line tag are:
To create a polygon we use <polygon> tag.
Example of a Simple polygon.
Output :
SVG POLYGON: <polygon> tag

14.
3D graphics , effects and HTML5
14
The attributes used with <polygon> tag are:
<line> tag is used to create a single straight line.The <polyline> tag is used to create any shape that consists
of only straight lines.
Example of a Simple Polyline.
points: This attribute is used to define the points of the line on the polygon. The shape of the polygon is completely
dependent on the points you define.
CSS fill: This attribute is used to fill color in the polygon.
CSS stroke: This attribute is used to define the color of the border of the polygon.
CSS stroke-width: This attribute is used to define the width of the border of the polygon.
style="fill:rgb(0,255,200)"/>
</svg>
</body>
</html>
Output :
SVG POLYLINE: <polyline> tag

17.
3D graphics , effects and HTML5
17
d: It’s the most important attribute of the <path> tag as it gives the direction in which the path is moving.
CSS stroke: This attribute is used to define the border. Also if this is not used nothing gets displayed.
CSS fill: This attribute is used to fill color in the shape created by the path.
CSS stroke-width: This attribute is used to define the width of the border.
Example of a Simple path.
As coding becomes very complex in <path> tag, it is better to use SVG editors to create objects.
Inkscape is one of the well known SVG editors.
<text> tag is used to display text using SVG.
Example of a Simple Text.
<!DOCTYPE html>
<html>
<head>
<title> Simple Text </title>
</head>
<body>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<text x="100" y="75" style="font-size:50"> Hey Guys!!! Its Party Time </text>
</svg>
</body>
</html>
Output :
SVG TEXT: <text> tag

21.
3D graphics , effects and HTML5
21
SVG filter effects are effects applied to Scalable Vector Graphics (SVG) files.
A filter effect is a graphical operation that is applied to an element as it is drawn into the document.
It is an image-based effect, in that it takes zero or more images as input, a number of parameters specific to
the effect, and then produces an image as output.
The output image is either rendered into the document instead of the original element, used as an input
image to another filter effect, or provided as a CSS image value.
<!DOCTYPE html>
<html>
<body>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<g fill="none" stroke="black" stroke-width="4">
<path stroke-dasharray="5,5" d="M5 20 l215 0" />
<path stroke-dasharray="10,10" d="M5 40 l215 0" />
<path stroke-dasharray="20,10,5,5,5,10" d="M5 60 l215 0" />
</g>
</svg>
</body>
</html>
Example of stroke-dasharray is:
Output :
SVG Filters

22.
3D graphics , effects and HTML5
22
A simple example of a filter effect is a "flood". It takes no image inputs but has a parameter defining a color.
The effect produces an output image that is completely filled with the given color.
SVG supports following filters:
As the name suggests it blends two or more images.SVG supports following filters:
In a more technical way it can be defined as:“This filter composites two objects together using commonly
used imaging software blending modes. It performs a pixel-wise combination of two input images.”
feBlend
feColorMatrix
feComponentTransfer
feComposite
feConvolveMatrix
feDiffuseLighting
feDisplacementMap
feFlood
feGaussianBlur
feImage
feMerge
feMorphology
feOffset
feSpecularLighting
feTile
feTurbulence
feDistantLight
fePointLight
feSpotLight
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
SVG Filter Primitive <feBlend> and <feOffset>:

24.
3D graphics , effects and HTML5
24
Output :
SVG Filter Primitive <feGaussianBlur>:
The <feGaussianBlur> element is used to create blur effects.
The attributes for <feGaussianBlur> are:
in: defines the image input to the blurring operation.
stdDeviation: The standard deviation for the blur operation. If two numbers are provided, the first number
represents a standard deviation value along the x-axis of the coordinate system established by attribute
‘primitive Units’on the <filter> element. The second value represents a standard deviation in Y. If one number
is provided, then that value is used for both X and Y.
A value of zero disables the effect of the given filter primitive.
There are many presentation attributes also.

26.
3D graphics , effects and HTML5
26
Output :
SVG Filter Primitive <feImage>
Example For Filter Primitive <feImage> is:
This filter primitive can refer to an external image or can be a reference to another piece of SVG. It produces
an image similar to the built-in image source Source Graphic except that the graphic comes from an exter-
nal source.
If the xlink:href references a stand-alone image resource such as a JPEG, PNG or SVG file, then the image
resource is rendered according to the behavior of the <image> element;
<html>
<head>
<title> <feImage> Example </title>
</head>
<body>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<defs>
<filter id="Default">
<feImage xlink:href="index.jpg" />
</filter>
</defs>
<rect width="100" height="150" filter="url(#Default)" />
</svg>
</body>
</html>

27.
3D graphics , effects and HTML5
27
SVG Filter Primitive <feColorMatrix>:
SVG Filter Primitive <feColorMatrix>:
The idea behind the feColorMatrix effect is to apply a matrix transform to the Red, Green, Blue and Alpha
channels of each pixel in the source image.
The feColorMatrix effect takes a type parameter which allows us to specify the full matrix or a shorthand
value that will calculate the rest of the matrix values for us.
There are 4 types of color matrices:
Type = matrix
Matrix
Saturate
hueRotate
luminanceToAlpha
Setting the type to "matrix" gives us access to the entire matrix.
The matrix coefficients are given in row-major order in a string separated by white space (including end of
line) or commas.
Type = saturate
A matrix type of "saturate" adjusts the saturation of the colour using a real number value of 0 to 1 supplied as
the "values" attribute of feColorMatrix.
Type = hueRotate
The "hueRotate" type takes an angle (in degree) as the value of "values" and rotates the pixel hue by the given angle.
Type = luminanceToAlpha
a type of "luminanceToAlpha" converts the red, green and blue channels into a luminance value then sets the output
alpha channel based to the result.
The "values" attribute is not used with this type.

29.
3D graphics , effects and HTML5
29
Output :
SVG Filter Primitive <feMerge> , <feComposite>, <feFlood>:
The SVG feMerge element is used to create image layers on top of each other.
Each feMerge element can have any number of feMergeNode sub-elements.
The SVG <feFlood> filter primitive creates a rectangle filled with the color and opacity values from proper-
ties‘flood-color’and‘flood-opacity’.
The rectangle is as large as the filter primitive subregion established by the‘x’,‘y’,‘width’and‘height’attrib-
utes on the‘feFlood’element.
The SVG <feComposite> filter performs the combination of the two input images pixel-wise in image space
using one of the Porter-Duff [PORTERDUFF] compositing operations: over, in, atop, out, xor.

31.
3D graphics , effects and HTML5
31
erode (thinning)
dilate (fattening)
<!DOCTYPE html>
<html>
<head>
<title> <feMorphology> </title>
</head>
<body>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<defs><filter id="erode">
<feMorphology operator="erode" in="SourceGraphic" radius="1" />
</filter>
<filter id="dilate"> orphology operator="dilate" in="SourceGraphic" radius="4" />
</filter>
</defs>
<g font-size="60">
<text x="10" y="50" filter="url(#erode)"> ERODE </text>
<text x="10" y="100" filter="url(#dilate)"> DILATE </text>
</g>
</svg>
</body>
</html>
SVG Filter Primitive <feMorphology>:
Example for <feMorphology>
The SVG feMorphology element is used to "fattening" or "thinning" a source graphic.
The operator attribute defines whether to erode or dilate the source graphic.
The operator attribute can take one of the following values:
The radius attribute defines the radius for the operation.
If two numbers are specified, the first number is the x-radius and the second number is the y-radius. If one
number is specified, then that value is used for both x and y. Default is 0

32.
3D graphics , effects and HTML5
32
‘feFuncR’— transfer function for the red component of the input graphic
‘feFuncG’— transfer function for the green component of the input graphic
‘feFuncB’— transfer function for the blue component of the input graphic
‘feFuncA’— transfer function for the alpha component of the input graphic
If more than one transfer function element of the same kind is specified, the last occurrence is to be used.
If any of the transfer function elements are unspecified, the ‘feComponentTransfer’ must be processed as if
those transfer function elements were specified with their‘type’attributes set to 'identity'.
Type: Indicates the type of component transfer function.
This filter primitive performs component-wise remapping of data for every pixel.
It allows operations like brightness adjustment, contrast adjustment, color balance or thresholding.
The child elements of a‘feComponentTransfer’element specify the transfer functions for the four channels:
The following rules apply to the processing of the‘feComponentTransfer’element:
The attributes of the sub elements are:
Output :
SVG Filter Primitive <feComponentTransfer>:

35.
3D graphics , effects and HTML5
35
The 'feTile' filter effect can be used with an input to create a tiled pattern that fills the filter area.
Example for Filter Primitive <feComponentTransfer>:
SVG Filter Primitive <feTile>:

37.
3D graphics , effects and HTML5
37
These filter primitives define light source as a point or a spot or light source from a distance.
The attributes of the <fePointLight> are x , y and z that defines the position of the light source in respect to
x, y and z direction.
The attributes of the <feSpotLight> are:
The attributes of the <feDistantLight> are
This filter primitive lights a source graphic using the alpha channel as a bump map. The resulting image is
an RGBA image based on the light color.
SVG Filter Primitive <fePointLight> , <feSpotLight> and <feDistantLight>:
SVG Filter Primitive <feSpecularLighting>:
‘x’,‘y’,‘z’ defines the position of the light source with respect to x , y and z direction resp.
‘pointsAtX’defines X location in the coordinate system established by attribute‘primitiveUnits’on the
‘filter’element of the point at which the light source is pointing.
‘pointsAtY’defines Y location in the coordinate system established by attribute‘primitiveUnits’on the
‘filter’element of the point at which the light source is pointing.
‘pointsAtZ’
‘specularExponent’defines Exponent value controlling the focus for the light source.
‘limitingConeAngle’defines A limiting cone which restricts the region where the light is projected. No
light is projected outside the cone.‘LimitingConeAngle’represents the angle in degrees between the
spot light axis and the spot light cone.
Azimuth: Direction angle for the light source on the XY plane (clockwise), in degrees from the x axis.
Elevation: Direction angle for the light source from the XY plane towards the z axis, in degrees.

45.
3D graphics , effects and HTML5
45
A gradient is a gradual transition from one color to another. A filter effect is a graphical operation that is
Gradients come in two basic forms: linear and radial. The type of gradient applied is determined by the
element you use.
SVG Gradients:
The <linearGradient> element is used to define a linear gradient.
The <linearGradient> element must be nested within a <defs> tag. The <defs> tag is short for definitions
and contains definition of special elements (such as gradients).
Linear gradients can be defined as horizontal, vertical or angular gradients:
SVG Linear Gradient <linearGradient>:
Example For Linear Horizontal Gradients:
Horizontal gradients are created when y1 and y2 are equal and x1 and x2 differ.
Vertical gradients are created when x1 and x2 are equal and y1 and y2 differ.
Angular gradients are created when x1 and x2 differ and y1 and y2 differ.
<!DOCTYPE html>
<html>
<head>
<title> Linear Horizontal Gradient </title>
</head>
<body>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<defs><linearGradient id="grad1" x1="0%" y1="0%" x2="100%" y2="0%">
<stop offset="0%" style="stop-color:rgb(255,0,0);stop-opacity:1" />
<stop offset="100%" style="stop-color:rgb(0,0,0);stop-opacity:1" />
</linearGradient>
</defs> <rect width="100" height="125" fill="url(#grad1)" />
</svg>
</body>
</html>

50.
With HTML5 we can play video and audio very easily.
There are 2 elements in HTML5 That come under multimedia
Today, most videos are shown through a plug-in (like flash). However, different browsers may have different
plug-ins.
HTML5 defines a new element which specifies a standard way to embed a video/movie on a web page: the
<video> element.
<video> tag
Example of a <video> tag:
<audio>
<video>
<source> : Defines the source of the video.
<track> : Defines text tracks in media players
<!DOCTYPE html>
<html>
<head>
<title> <video> </title>
</head>
<body>
<video height="300" width="450" controls>
<source src="video1.mp4" type="video/">
</video>
</body>
</html>
Output:
MULTIMEDIA AND HTML5
50

51.
The attributes of the <video> tag are:
<audio> tag
Example of <audio> tag:
Height: Defines the height of the window in which the video is displayed.
Width: Defines the width of the window in which the video is displayed.
Control: Displays the controls like: PAUSE, PLAY and VOLUME.
The attributes of the <source> tag are:
Today, most audios are shown through a plug-in (like flash). However, different browsers may have different
plug-ins.
HTML5 defines a new element which specifies a standard way to embed a audio on a web page: the
<audio> element.
The sub elements of <audio> tag are:
Src: Defines the source of the video file.
Type: Defines the MIME type of the video like video/mp4 or video/ ogg or video/webM.
<source> : Defines the source of the audio.
<!DOCTYPE html>
<html>
<head>
<title> <audio> </title>
</head>
<body>
<audio controls>
<source src="audio1.mp3">
</audio>
</body>
</html>
MULTIMEDIA AND HTML5
51

52.
The attribute of the <audio> tag are:
Control: Displays the controls like: PAUSE, PLAY and VOLUME.
The attribute of the <source> tag are:
Src: Defines the source of the audio file.
Type: Defines the MIME type of the audio like audio/mpeg or audio/ogg or audio/wav.
Output:
MULTIMEDIA AND HTML5
52

54.
HTML5 has introduced many new semantics to easily develop the format of the webpage.
Semantics define the meaning of the block.
The new elements that are defined as the semantics are:
<header> : The <header> tag is used to define the header of the webpage. It generally contains the logo or the title
that defines the purpose of the webpage.
<footer> : The <footer> tag is used to define the footer of the webpage. It generally contains the information about
the author, the copyright conditions, links to terms of use, contact information, etc.
<nav> :The <nav> element defines a set of navigation links.The <nav> element is intended for large blocks of naviga-
tion links. However, not all links in a document should be inside a <nav> element!
<section> : The <section> element defines the title of the content written in the page.
<article> : The <article> element is the actual body of the webpage. It contains the actual content for which the web-
page is made. It contains data, pictures, links etc.
<aside> : The <aside> element defines some content aside from the content it is placed in (like a sidebar). It is gener-
ally used for vertical navigation, news, updates etc.
<figcaption> : The <figcaption> defines a caption for the figures.
<figure> : The <figure> element is used to define the figure and diagrams in the content.
54
HTML 5 SEMANTICS and HTML5 FORMS

59.
HTML5 allows new input types for forms. These input types add features for better control and validation.
The new input types are:
color – If a browser supports this input type, the intention is that clicking in the textfield will result in a color chooser
popping up
Syntax: <input type=”color”name=”name”/>
Attributes :
Value: It defines the initial value.This color will be shown in the textfield and also when the color chooser opens
it selects that color only by default.
Output:
HTML5 Form Semantics: New Input types
HTML 5 SEMANTICS and HTML5 FORMS
59
Supported in Browsers: CHROME and OPERA.

61.
On Clicking the Red Color Text field a Color Browser pops up with red
color selected as default selection:
HTML 5 SEMANTICS and HTML5 FORMS
61
date – This works the same as the datepicker. When you click the textfield a calendar is displayed and allows you to
select a date from it.
Syntax: <input type=”date”name=”name”/>
Attributes :
Value: The initial value that is by default displayed in the text field.
Step: The step size in days. By default it is 1.
Min , Max : The minimum and maximum date that can be selected.
Supported in Browsers: CHROME, SAFARI and OPERA.

66.
Output:
Now in this first you have to select the month or year field and then click the up or
down arrow: For month:
HTML 5 SEMANTICS and HTML5 FORMS
66
number – This element lets you select a number. It is also known as spinner.
Syntax: <input type=”number”name=”name”/>
Attributes :

67.
<!DOCTYPE html>
<html>
<head>
<title> Input Element number </title>
</head>
<body>
<form action="inputdemo.php" method="post">
Enter a Number: <input type="number" value="5" step="2" name="number"/>
<input type="submit" value="Submit" />
</form>
</body>
</html>
Output:
Example for <input type=”number”/>
HTML 5 SEMANTICS and HTML5 FORMS
67
range – This element allows the user to select a value between the given range.
Syntax: <input type=”range”name=”name”/>
Attributes :
Value: It defines the initial value. Also it is always halfway between the min and max.
Step: It change in the number on moving the slider is known as step. It is by default 1.
min, max – Defines the minimum and maximum value of the range.
Supported in Browsers: IE, CHROME, SAFARI and OPERA.
Value: It defines the initial value. If this field is not set the field is defined blank.
Step: It defines the step size.The difference in the selected number is number displayed after clicking up and
down arrow is called step. By default it is 1.
min and max: The minimum and maximum value that can be selected on clicking the up and down arrows.
Supported in Browsers: CHROME, SAFARI and OPERA.

73.
On entering a Wrong URL and hitting Submit the output is as follows:
Now on hitting Submit:
HTML 5 SEMANTICS and HTML5 FORMS
73
week – This element allows the user to select a week and a year.
Syntax: <input type=”week”name=”name”/>
Attributes :
Value: Sets the initial value.
Supported in CHROME, SAFARI and OPERA.

74.
HTML5 has defined many new attributes for <form> tag and <input> tag.
The attributes defined for <form> tag are:
autocomplete: When the autocomplete attribute is on the value of entered by the user will be automatically com-
pleted by the values entered by the user before. If it is off the user will have to enter the whole value.
<!DOCTYPE html>
<html>
<head>
<title> Input Element week </title>
</head>
<body>
<form action="inputdemo2.php" method="post">
Enter A Particular Week: <input type="week" name="week" />
<input type="submit" value="Submit" />
</form>
</body>
</html>
Output:
HTML5 Form Semantics: New Form Attributes
Example for <input type=”week”/>
HTML 5 SEMANTICS and HTML5 FORMS
74
Syntax: <form autocomplete=”off/on”> / <input autocomplete=”off/on”/>
autocomplete only works with input type text, search, url, tel, email, password, datepickers, range, and color.
Supported in Browsers: IE, FireFox, Chrome and Safari

78.
Output:
Fill the Form:
On hitting submit in actual the validation alert is displayed as we saw before in input elements
but here the form gets submitted and the output is displayed as follows: This is all because
of the novalidate attribute. It doesn’t allow the element to perform validation.
HTML 5 SEMANTICS and HTML5 FORMS
78
The attributes defined for the <input> tag are:
autofocus: When you use autofocus for any input tag in the form and load the form that input will be in focus by
default.
Syntax - <input type=””autofocus />
Supported by all the Browsers.

81.
Output:
On hitting Submit the email-id will also be passed to the php file:
HTML 5 SEMANTICS and HTML5 FORMS
81
formaction: The formaction attribute specifies the URL of a file that will process the input control when the form is
submitted.
The formaction attribute overrides the action attribute of the <form> element.
The formaction attribute is only used with the input type image and submit.
Syntax: <input type=”image/submit”formaction=”name_of_file_where _to_submit”/>

84.
<!DOCTYPE html>
<html>
<head>
<title> Input Attribute formenctype </title>
</head>
<body>
<form action="attributedemo7.php" method="get">
Enter Your First Name: <input type="text" name="fn" /><br/>
Enter Your Last Name: <input type="text" name="ln" /> <br/>
<input type="submit" value="Submit"/>
Now On Clicking Submit to AttibuteDemo4.php:
formmethod.html:
Example for Attribute formenctype:
Example for Attribute formmethod:
HTML 5 SEMANTICS and HTML5 FORMS
84
formenctype: This attribute encodes the data posted from the form to the server.
The formenctype attribute overrides the enctype attribute of the <form> element.
This attributes can only be used with the input types: submit and image.
Syntax: <input type=”submit/image”formenctype=”multipart/form-data”/>
formmethod: This attribute defines the HTTP method for sending the data of the form.
It overrides the effect of method attribute stated in the form tag.
This attribute can only be used with the input types: submit and image.
Syntax: <input type=”submit/image”formmethod=”get/post”/>

86.
On Clicking the Submit Button the get method specified in the form tag will be executed:
On Clicking the Submit Using formmethod Button the formmethod will be executed.
As Here We have specified the value post, the form will be submitted using post method.
Output:
HTML 5 SEMANTICS and HTML5 FORMS
86

87.
<!DOCTYPE html>
<html>
<head>
<title> Input Attribute formtarget </title>
</head>
<body>
<form action="attributedemo9.php" method="get">
Enter Your First Name: <input type="text" name="fn" /><br/>
Enter Your Last Name: <input type="text" name="ln" /> <br/>
<input type="submit" value="Submit to new tab" formtarget="_blank"/>
</form>
</body>
</html>
For example refer novalidate attribute. Just replace novalidate with formnovalidate and
move it from form tag to <input type=”submit”/>
formtarget.html:
Example for attribute formtarget:
HTML 5 SEMANTICS and HTML5 FORMS
87
_blank - The response is displayed in a new window or tab
_self - The response is displayed in the same frame (this is default)
_parent - The response is displayed in the parent frame
_top - The response is displayed in the full body of the window
framename - The response is displayed in a named iframe
formnovalidate: This attribute is used when we donot want to validate the data entered in the form.
Works same as novalidate attribute.
This attribute can only be used with the input types: submit.
Synatx: <input type=”submit/image”formnovalidate />
formtarget: The formtarget attribute specifies a name or a keyword that indicates where to display the response that
is received after submitting the form.
Values:
This attribute can only be used with the input types: submit and image.
Syntax : <input type=”submit/image”formtarget=”_blank | _self | _parent | _top | framename”/>