What are attributes?
HTML attributes are some extra information provided inside the starting tags, they provide some additional features to the HTML tags.
<img> tag is used to insert images in the webpage, src attribute defines the link or path to the image. alt is also an attribute that is displayed when an image couldn’t be loaded because of some error, screen readers read out alt text when they encounter the image while going through the webpage. alt data is displayed when you hover over an image.
You can also add dimensions to an image using attributes.
<img src=”./car.jpg” alt=”car image” width=”100” height=”100”>
<a> tag is use to add links and href attribute is used to specify the url.
<a href=”https://terminalstack.com”>Terminal Stack</a>
There are many more attributes that you will learn as we proceed in the course.
Some takeaways from this episode are:
- Attributes are used to add some extra features to a tag.
- Attributes are added in opening tags.
- They are used as, attribute_value=”value”
This is all you need to know about attributes in order to make websites. In next episode we will learn how to add comments in HTML and use them effectively while development.