< HTML 5 Programming and Web development

HTML 5 attributes are created using a name-value pair and are usually put alongside the tag name.

Name-value pairs

Name-value pairs are represented by a set of text strings in which name="value" and are usually separated by commas,semicolons,space or newline character.

Writing HTML 5 Atrributes

HTML 5 attributes are written inside the element's tag and separated by spaces. For example:

<input type="text" value="hello Web"/>

In this code the attributes are type and value and their values are "text" and "hello Web" respectively.

What do Attributes do

Attributes give extra information about an element for example in the input element the attribute type gives the type of input, so if he had type="button" we would get a button instead of a textbox.Attributes are very important to HTML and without them Web development would be probably much harder.

Special Attributes

HTML 5 has some special attributes that I must point out.

The Id Attribute

The Id attribute is a unique Identifier for the element.The Id property becomes very useful when using CSS and JavaScript.An example of the Id Attribute.

<form id="htm_form">
</form>

The name Attribute

The name Attribute specifies a name for an element.Conventionally groups if elements can have the same name.

The class attribute

This specifies the style class under which an element falls. NB:An Attribute can also be called a property

This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.