HTML Attributes

Attribute provides additional features to tag or we can say that it enhances the performance of a webpage. It performs a major role in the form, table and to provide styles to elements. Attribute always come in name/value pair in which name is unique within the tag and value is always enclosed within either single quotes or double quotes.

The general syntax of an attribute is-

<tag attributename="value">Content</tag>

Here are some basic examples to explain attribute.

HTML Attributes Example1

<body bgcolor="red">
<p>Welcome to etutorialspoint.</p>
</body>

In the above example, the body tag has an attribute name 'bgcolor' and it has 'red' value. This attribute set whole body background to red color.





HTML Attributes Example2

<table border='1'>
<tr>
<td>EtutorialsPoint</td>
</tr>
</table>

In the above example, the border attribute is used to set the table border.





Read more articles