There are few attributes in HTML which are widely used and provide additional information about web elements. The most important ones are listed below:
1. href attribute
<a href="https://www.ishandevshukl.com">Visit Ishan's blog</a>
Here href is the attribute that defines URL to open on clicking Anchor text.
2. src, width & height attributes
<img src="https://bit.ly/2EsXD7i" width="400" height="300">
Here src, width, height are the attributes defining absolute path and dimensions of the image.
3. alt attribute
<img src="https://bit.ly/2EsXD7i" alt="Profile Picture">
Here alt atribute defines alternative text in case any image is unable to load.
4. style attribute
style attribute is used to add color, font, size, and more to a webelement.
<p style="color:blue;">This is a blue paragraph.</p>
5. lang Attribute
Used to define the language of webpage for browser to understand. It's always a good practice to add lang.
<!DOCTYPE html>
<html lang="en">
<body>
...
</body>
</html>
6. title attribute : Displays Help Text on Mouseover
<p title="This is a tooltip">This is a paragraph.</p>
Copy Paste Below code in Notepad --> Save with extension .html and open it in Browser to practically see what we learnt from this Tutorial.
Comments
Post a Comment
Thanks a lot for your valuable Comment!