HTML Attributes
Attributes in HTML:
Attribute generally provides extra information about the elements in HTML and tags. It is just like features to specific elements. In HTML attributes come with a unique value and name. it is specifically placed in the initiation of the tag.
href Attribute:
It is the attribute of <a> tag with creating a hyperlink, it generally brief on the URL of the webpage to be switched.
Example:
<a href="https://dreamzdevelopers.com">go to site</a>
src Attribute:
This is the attribute of the <img> tag known as an image tag. src, the attribute is used to fetch the image location from the machine.
Example:
<img src="flower.jpg" />
1. Relative Path:
It is a path that is presented in our location of the website folder.
<img src="./flower.jpg" />
<img src="./directory_name/flower.jpg" />
<img src="../flower.jpg" />

inside the directory

If image not found or you don’t have permission to access the image
2. Absolute Path:
It is a path that is presented outside of your website location.
<img src="https://cdn.pixabay.com/photo/2014/02/27/16/10/tree-276014_960_720.jpg" />
It will look in your browser

width and height attributes:
The width and height attributes are used in <img> tag to set image boundaries which take values in pixels.
Example:
<img src="flower.jpg" width="234" height="343">
alt Attribute:
If the image is not displayed in using the <img> tag for some reason, so alt attribute is helpful. It will show the alternative text in place of the image.
Example:
<img src="flower.jpg" alt="This is flower">
style attribute:
This attribute is used to add styles in an element using the name/ value of that tag.
Example:
<p style="color:blue;">This is a blue paragraph.</p>
This is a blue paragraph.
title attribute:
When you hover the mouse over the tag the content present in the title attribute is shown, which will display some content.
Example:
<p title="I'm a tile">Click me to view.</p>
Click me to view.
Note: What good thing about HTML is that HTML does not require quotes around attribute values.
We can use both double and single quotes in the values of tags. On the other hand when the attributes themselves have double quotes then in this case you should use single quotes respectively.
See the Pen HTML Attributes by Jehal Desai (@my-dreamzlive) on CodePen.
