Home Advertise with us Forum Articles Sitemap Contact
Logo  

HTML Attributes

Attributes in HTML serve to amplify tags. HTML attributes are applicable to most HTML elements & function to provide additional information about the element. In simpler terms, these attributes provide a scope to make additional settings in the style or characteristic of the element like, change their background color, width & make other desirable changes.

The HTML tags can contain one or more attributes. These attributes are added to the different tags primarily to provide additional information to the browser about the way a particular tag should appear or behave. Attributes are specified on the start tag & appear as a name/value pair separated by an equals (=) sign.
 
Eg : <body style="background-color:red">
 


Addition of this particular attribute sends a message to the browser to style the body element with background color red.

An important factor to remember while specifying attributes is to always enclose the attribute values in quotes, either the double style or single style quotes. Just in case the attribute value itself contains double quotes, one is required to use single quotes.

 
Eg : Name='Shawn "Badman" Fredo'
 


Although the attribute names & values are not case sensitive, it is advisable to use them in lowercase, in accordance to the newer HTML versions.

Table of HTML Attributes

Attribute

Value

Description

Class class_rule or style_rule Describes the class of the element
Id id_name Represents a unique id for the element
Style style_definition Represents an inline style definition
Title tooltip_text Represents a text to be displayed in tool tip
 

HTML Tip 1

Use only hexadecimal #RGB values for colors. The behavior of named colors is browser-idiosyncratic and totally unpredictable.
 
 

HTML Tip 2

You can resize your images without a graphics program by changing the HEIGHT and WIDTH in your image tag.