Types of Attributes in HTML5
An HTML attribute provides additional information about an HTML element
- All HTML elements can have attributes
- Attributes provide additional information about an element
- Attributes are always specified in the start tag
- Attributes usually come in name/value pairs like: name="value"
Example of HTML Attributes
HTML links are defined with the
<a>
tag. The link address is specified in the href
attribute
<a href="https://www.w3schools.com">This is a link</a>
Here href is attribute
HTML images are defined with the
<img>
tag.
The filename of the image source is specified in the
src
attribute
<img src="img_girl.jpg" width="500" height="600">
Here src, width and height are attributes
<p title="I'm a tooltip">
This is a paragraph.
</p>
<p style="color:red">This is a red paragraph.</p>
Above example "title" and "style" are the attributes
Comments
Post a Comment