Attributes of HTML give additional characteristics or properties of the elements such as the width and height of an image.
These attributes are always specified in the start tag and usually consist of name/value pairs like name=”value”.
The name is the property you want to set and the value is the value of the property you want to set and always put within quotations.
Attribute values should always be enclosed in quotation marks.
You can add multiple attributes in one HTML element, you just need to give space between two attributes.
The src Attribute:
The src attribute is used with img tag when you want to add the image to your webpage, you need to specify the address of the image as the attribute’s value inside the double quote.
The alt Attribute:
The alternate tag is used to show or display something if the primary attribute i.e., the <img> tag, fails to display the value assigned to it.
This can also be used to describe the image to a developer who is actually sitting at the coding end.
The height and width Attribute:
In HTML images have width and height attributes, which are used to adjust the width and height of an image.
By default, the height and width are specified in pixels.
The href Attribute:
The href attribute is used to specify a link to any address. The address of the link is specified in the href attribute.
This attribute is used along with <a> tag. The link put inside the href attribute gets linked to the text displayed inside the<a> tag. On clicking on the text we will be redirected to the link.
The title Attribute:
The title attribute is used as a text tooltip on hovering the mouse over an element.
Its text is display when the user move the cursor over a link or any text. You can use it with any text or link to show the description of that link or text.
The lang Attribute:
The language attribute allows you to indicate the language used in a document.
This attribute is declared in the <html>tag and it is declared with the lang attribute.
Language declaration can be important for accessibility applications and search engines.
<html lang=”en-US”> means “this page is in the US style of English.”