HTML Attributes

Attributes provide additional details to the HTML tags like id, name, style and so on.


Syntax

HTML Attribute can be applied only in the opening tags.

All attributes are in the format name="value"

HTML Attributes Example



<a href="html-tags.html">This is a Link</a>

		

Preview

In the above example, the attribute 'href' is used for the tag <a>.

Attributes like id, name, style, class, etc. are common to all tags. But there are attributes which can be applied only to specific tags for instance the 'href' attribute can not be applied to paragraph tag or heading tag.

In below, we provide some tag and its attributes

HTML Table Attribute

Attribute Name Description value
align specifies the alignment of table content left, right and center
bgcolor specifies the background color rgb(rd_value,gn_value,blue_value),colorname and colorvalue
border specifies the cells borders bordervalue
cellpading specifies the space between cell content and cell wall pixels
cellspacing specifies the space between cells pixels
sortable specifies the table should be sortable sortable
summary specifies the content summary text
width specifies the width of the table pixels and %

Next Lesson > HTML Heading