What are HTML attributes and how to use them?
HTML attributes provide additional information about HTML elements.

Do you have similar website/ Product?
Show in this page just for only
$2 (for a month)

0/60
0/180
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:
href Attribute
HTML links are defined with the <a> tag and link address is specified in the href attribute
E.g:
<a href="https://newsandstory.com" > This is the link</a>
src Attribute
HTML images are defined in <img>
tag.
The filename of the image source is specified in the src attribute
E.g:
<img src="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 src="img_1.png" width="200" height="300">
alt Attribute
The alt attribute specifies an alternative text to be used when an image cannot be displayed.
<img src="img_1.png" alt="First image">
style Attribute
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>
lang Attribute
The language is declared with the lang attribute
E.g:
<html lang="en-US">
title Attribute
The value of the title attribute display as a tooltip when you mouse over the paragraph
E.g:
<p title ="Thi is Tooltip">ACSVGDDHHSDSDJHSDH</p>
CONTINUE READING
HTML
Ayesha
Tech writer at newsandstory