An attribute define the additional information of an HTML element and is placed inside the element’s opening tag. An attribute come in name/value pairs ex: name=”value”.

The Lang Attribute

The language is declared in the lang attribute.
Example:–

<!DOCTYPE html>

<html lang=”en-US”>

<head>

<title>The language Attribute Example</title>

</head>

<body>

<p> en define English language and US define county </p>

Code…..

</body>

</html>

The Title Attribute

The title attribute gives a suggested title for the element. It is also displayed as a tooltip when cursor comes over the element or while the element is loading.

Example:–

<!DOCTYPE html>

<html lang=”en-US”>

<head>

<title>The Title Attribute Example</title>

</head>

<body>

<span title=”webpage/ element html”> this is example of title of element or web page </span>

Code…..

</body>

</html>

The Class Attribute

The class attribute is used to associate an element. We can use more the one class of one element.
Example:–

<!DOCTYPE html>

<head>

<title>The Class Attribute Example</title>

</head>

<body><span class=”ele1 ele2 ele3 ……”> this is example of class of element </span>

Code…..

</body>

</html>

The Style Attribute

The style attribute use for specify Casecading Style Sheet (CSS) rules within the element. Style attribute are width, color, height, text decoration, align, bgcolor, id etc…

Example:–

<!DOCTYPE html>

<head>

<title>The Style Attribute Example</title>

</head>

<body>

<span style=”color:#fff;”> this is example of styling of element </span>

Code…..

</body>

</html>

Related Article