HTML Attributes

Attribute is used to provide additional information of HTML elements and is placed inside the element’s tag.
All elements have attributes in HTML.
Attributes are used to provide additional information about an element
Attributes are always used in the element’s start tag
Attributes usually made up of two parts: a name and a value like: name=”value”

Title Attribute in HTML

The title attribute can be added with <a>,<p> and other elements. The title attribute value will be displayed on mouse over.

Example

<a title=”Title Value”>
Hyperlink emample for title.
</a>
<p title=”Title Value”>
Paragraph emample for title.
</p>

lang Attribute in HTML

The language is declared with the lang attribute.

Example:

<!DOCTYPE html>
<html lang=”en”>
<body>

Content
</body>
</html>

Alt Attribute in HTML
The alt attribute is used with img tag to specifies an alternative text.

Alt attribute value can be read by screen readers.
Example

<img src=”myimage.png” alt=”Blogshub Tutorial” >

Leave a Reply

Your email address will not be published. Required fields are marked *