In this tutorial you will learn about the HTML Attributes and its application with practical example.
HTML Elements can have an optional list of modifiers added to the tag. This modifiers are known as HTML attributes, they defines the characteristics of the HTML Elements on which they are applied.
Whenever HTML Elements is rendered by browser, the attributes gives the more information about the appearance and the behavior the HTML Elements.
Attributes made of a name and a value pair separated by the equals (=) sign.
Syntax:
1 |
<tagname attribute-name="attribute-value">content</tagname> |
List of some of the Basic Attribute –
Attribute | Attribute Values | Description |
align | right, left, center | This attribute specifie the horizontal alignment of an HTML element. |
valign | top, middle, bottom | This attribute specifie the vertical alignment of an HTML element. |
bgcolor | numeric, hexidecimal, RGB values | This attribute specifie background color for an HTML Element |
background | URL | This attribute specifie background image for an HTML Element |
id | User Defined | This attribute used to specify the unique identifier for the HTML Element. |
class | User Defined | This attribute specifies the CSS Class for the HTML Elemetns. |
width | Numeric Value | This attribute specifies the width of HTML Elemetns like tables, images, or table cells. |
height | Numeric Value | This attribute specifies the height of HTML Elemetns like tables, images, or table cells. |
title | User Defined | This attribute specifies title of HTML Elements. |