HTML5 input attribute, Define the type, alt and image  of input tag.


 

HTML5 input attribute, Define the type, alt and image  of input tag.

In this tutorial, you will see the the use of type, alt and image attribute of input tag.

In this tutorial, you will see the the use of type, alt and image attribute of input tag.

HTML5 input attribute, Define the type, alt and image  of input tag.

Introduction:

Here we will introduce you to about the type attribute of input tag. It is define the type of data. which can be insert by user. User can insert only given type of data. It is most important for input tag. The alt  attributes can be used with image type of input tag. This string will display when image is not displayed.

Type Attribute:
Attribute Value Description
type



alt
hidden
text
image

string
It hides the field. User can not manipulate data.
It is a text field. User can insert a text string without break line.
User can insert a image. like a button

This string will display when image is not displayed.

Declaration Syntax :

Declaration syntax of type and alt attribute of input tag in HTML5.

                           <input  type="value" alt="text" />

Example of <input> in HTML5:

Code:
InputTag.html
<!doctype html >
<html>
<head><title>Title of document</title></head>
<body>
<h1>Input tag.</h1>
<h2>Implementation of input tag type, alt attributes.</h2>
<form><table style="width: 61%">
<tr>
<td style="width: 149px">Type=Hidden </td>
<td>&nbsp;</td>
<td><input type="Hidden" value="hidden" ></td>
</tr>
<tr>
<td style="width: 149px">Type=Text </td>
<td>&nbsp;</td>
<td><input type="text" value="RoseIndia"> </td>
</tr>
<tr>
<td style="width: 149px">Type=Image&nbsp; </td>
<td>&nbsp;</td>
<td>
<input type="image" src="RoseIndiaPick.jpg"
alt="Type is image" name="RoseIndia" > </td>
</tr>
<tr>
<td style="width: 149px">Type=Image&nbsp; </td>
<td>&nbsp;</td>
<td><input type="image" src=""
alt="Image of submit button" name="Image button"> </td>
</tr>
</table></form></body>
</html>
Output:

Download this code

>

Difference Between HTML5 and HTML4.01:

The input tag is available in both HTML5 and HTML4.01. But there is some attribute in HTML5, that is not supported by HTML4.01.

Ads