Attributes of HTML give additional characteristics or properties of the elements such as the width and height of an image.
These attributes are always specified in the start tag and usually consist of name/value pairs like name=”value”.
The name is the property you want to set and the value is the value of the property you want to set and always put within quotations.
Attribute values should always be enclosed in quotation marks.
You can add multiple attributes in one HTML element, you just need to give space between two attributes.
The src Attribute:
The src attribute is used with img tag when you want to add the image to your webpage, you need to specify the address of the image as the attribute’s value inside the double quote.
The href attribute is used to specify a link to any address. The address of the link is specified in the href attribute.
This attribute is used along with <a> tag. The link put inside the href attribute gets linked to the text displayed inside the<a> tag.
On clicking on the text we will be redirected to the link.
Example:
<a href=”http://w3codingschools.com/”> This is a link < /a>
This attribute is used to give various CSS(Cascading Style Sheets) effects to the HTML element such as increasing font-size, changing font-family, coloring etc.
Example:
<h2 style=”color:green;”> This is a heading </h2>
<h3 style=”text-align:center;”> This is a heading </h3>
The title attribute is used as a text tooltip on hovering the mouse over an element.
Its text is display when the user move the cursor over a link or any text. You can use it with any text or link to show the description of that link or text.
Example:
<p title=”This is a paragraph”> Hover to see the effect </p>
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.Ok