What are HTML attributes and how to use them?
HTML attributes provide additional information about HTML elements.
All HTML elements can have attributes Attributes and they provide additional information about an element .
They are always specified in the start tag Attributes usually come in name/value pairs like: name="value"
Different used attributes of HTML are:
HTML links are defined with the <a> tag and link address is specified in the href attribute
<a href="https://newsandstory.com" > This is the link</a>
HTML images are defined in <img> tag.
The filename of the image source is specified in the src attribute
Width and height Attributes
Images in HTML have a set of size attributes which specifies the width and height of the image and image size is specified in pixels.
<img src="img_1.png" width="200" height="300">
The alt attribute specifies an alternative text to be used when an image cannot be displayed.
<img src="img_1.png" alt="First image">
The style attribute is used to specify the styling of an element, such that color, font, size etc.
<p style="color:red"> This is a paragraph</p>
The language is declared with the lang attribute
The value of the title attribute display as a tooltip when you mouse over the paragraph
<p title ="Thi is Tooltip">ACSVGDDHHSDSDJHSDH</p>
Tech writer at newsandstory
Total 139 views