This is my Day-4 of learning HTML. Today I learned about the HTML Attributes.
HTML ATTRIBUTES:
- Attributes are used to provide the additional information about the HTML Element.
- Attributes are always written inside the start tag of the HTML element.
- All the HTML elements can have attributes.
- Attributes usually in the name-value format.
Example for Attributes:
Width
Height
src
type
alt
....
Here, I have only listed few attributes. However, HTML have more attributes. Let's explore them one by one in detail.
HEIGHT AND WIDTH:
Height Attribute: The Height attribute is used to adjust the height of the element.
Width Attribute: The width attribute is used to adjust the width of the element.
Example:
<img src="./rose.jpg" width="600px" height="500px">
Alt:
Alt attribute : Alt attribute is used inside the <img> tag. Alt provides the alternative text for an image given inside the <img> tag. If the image is not displayed due to any reasons, at that time this alternative text is displayed which is useful for user to get an idea about that image.
Example:
<img src="./ros.jpg" width="600px" height="500px" alt="Rose Image">
TYPE:
Type attribute: The type attribute is used inside the <input> tag. The type attribute specifies the type of the input field and it determines the type of data that the user can enter in the form.
Some of the values of the type attribute:
text- used to enter the text only
password - used to enter the passwords
email - used to enter the email
number - used to enter the number
<form>
<label for="username">Username</label>
<input id="username" type="text">
</form>
See you in the next learning update!

Top comments (0)