Wednesday, 8 July 2015

HTML5 Form Attributes Tutorial

HTML elements also have attributes which provide the additional information about an element. Attributes are like blue print schematics informing the browser how to render an HTML element. Attribute always come in name and value pair.
The name is the property you want to set and the value is what you want the value of the property to be.
The value of the html5 attribute should be put in double quotation marks, and is differentiated from the name by the equals sign. You can see that a color for the text has been define as well as the typeface in this <font> element:

<font face=”Times New Roman” color=”013975″>

The title attribute:

The title attribute titles an HTML element and adds a tiny text pop-up to any HTML element,It defines a title to keep company with the component,several browser can show this once the pointer hovers the component.

Example:

<h3 title=”Hello World”>Titled Heading Tag Example</h3>

The id attribute:

The id attribute can be used to uniquely identify any element within a page.If you have two elements of the same name within a Web page you can use the id attribute to distinguish between elements that have the same name.

Example:

<p id=”html tags”>This paragraph explains all about HTML tags</p>
<p id=”php”>This paragraph explains what is php</p>

The class attribute:

The class attribute is employed to associate an element with a style sheet, and defines the class of element.It specifies the element class name.

Example:

class=”html 4.1 html 5″
The style attribute:
It defines Helps to include inline cascading style sheet.

Example:

<p style=”font-family:arial black; color:#2d2d2d;”>description…</p>

The  Formaction attribute:

The formaction html attribute elements defines the URL of a file that will process the input control when the form is submitted. This attribute overrides the action attribute of the <form> element.

Example:

<form action=”example_form.php”>
Username: <input type=”text” name=”uname”><br>
Password: <input type=”text” name=”password”><br>
<input type=”submit” value=”Submit”>
</form>

Output:


Username: Password:

Submit

No comments:

Post a Comment