What are HTML attributes and how to use them?
HTML attributes provide additional information about HTML elements.
![NewsAndStory Ads](/logo/ad-logo.png)
Do you have similar website/ Product?
Show in this page just for only
$2 (for a month)
![NewsAndStory Ads](/logo/ad-logo.png)
0/60
0/180
All HTML elements can have attributes
Attributes and they provide additional information about an element .![](img_1.png)
![](img_1.png)
![First image](img_1.png)
They are always specified in the start tag
Attributes usually come in name/value pairs like: name="value"
Different used attributes of HTML are:
href Attribute
HTML links are defined with the tag and link address is specified in the href attribute
E.g:
src Attribute
HTML images are defined in
tag.
The filename of the image source is specified in the src attribute
E.g:
![](img_1.png)
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.
E.g:
![](img_1.png)
alt Attribute
The alt attribute specifies an alternative text to be used when an image cannot be displayed.
![First image](img_1.png)
style Attribute
The style attribute is used to specify the styling of an element, such that color, font, size etc.
This is a paragraph
lang Attribute
The language is declared with the lang attribute
E.g:
title Attribute
The value of the title attribute display as a tooltip when you mouse over the paragraph
E.g:
ACSVGDDHHSDSDJHSDH
CONTINUE READING
HTML
Ayesha
Tech writer at newsandstory