Attribute | Description |
---|---|
alt | This attribute <img> is used in tags. If the image is not displayed, the text of this attribute is displayed in the browser as an alternative. |
charset | This attribute <meta> is used in tags. That is, it is used to specify the character encoding. |
disabled | This attribute <input> is used in the tag. That is, this attribute is used to disable a specific input element. |
href | This attribute <a> is used in the tag. That is, it is used to set the URL of a link. |
long | Contains information about the language of the document. |
id | Sets a unique name for an element. |
source | Sets the source of an image or script. |
style | It is used to style an element inline. |
title | It is used to attach additional information about an element. The content of the title attribute is displayed as a tooltip when the mouse is hovered over the element with title . |
alt attribute
alt
The attribute is used to set a text alternative to the image if the image is not displayed .
Examples
HTML alt attribute
Output

charset attribute
Attributes are used <meta>
within tags to specify the character encoding of the document .charset
To display any language other than English correctly in browsers, charset=”utf-8″ is used.
Examples
HTML charset attribute
Charset="utf-8" is used to display any language other than English correctly in browsers.
The Bangla font used in our examples when trying it yourself
If your browser does not support or the Bangla font breaks, you can use charset="utf-8"
to fix the font problem.
Output
Charset="utf-8" is used to display any language other than English correctly in browsers.
The Bangla font used in our examples when trying it yourself If your browser does not support or the Bangla font breaks, you can use charset="utf-8" to fix the font problem.
href attribute
The URL is set via the attribute of the HTML <a>
, <area>
, <base>
, <link>
tag .href
Examples
HTML href attribute
This is a link
Output
lang attribute
Attributes are used <html>
within tags to set the language of the document .lang
Examples
HTML lang Attribute
The lang attribute is used within the tag to set the language of the document.
src attribute
Attributes are used to add HTML <img>
and tag source files.<script>
src
Examples
HTML src attribute
Output

title attribute
title
The attribute is used to display text in the form of a tooltip when the mouse hovers over the element .
Examples
HTML title attribute
When you hover over this paragraph, the
value of the title attribute will be displayed as a tooltip.
Output
When you hover over this paragraph, the value of the title attribute will be displayed as a tooltip.
Always write attributes in lowercase.
In HTML(5), attribute names are not required to be written in lowercase.
charset
The attribute can be written in capital letters or small letters. For example, Charset or CHARSET .
However, the W3C recommends always writing HTML attributes in lowercase.
Using quotation marks in attribute values
In HTML(5), it is not mandatory to enclose attribute values in quotation marks (“”).
href
For example, the attribute can be written without quotation marks (“”) as described above:
Examples
HTML Attributes
This is a link
Output
But sometimes it is necessary to use quotations(“”). For example, in the example below, it will not work properly because the title attribute value has spaces.
Examples
HTML Attributes
If the attribute value contains a space,
you cannot remove the quotation marks ("").
Output
Single(' ') or double(" ") quotations
Double (“”) quotation marks are usually used to write the value of HTML attributes. However, we can also use single (‘ ‘) quotation marks.
However, single/double quotations are used in attribute values according to the situation and need.
Quick Learn
Or we can use it the other way around.
SAT Academy
Chapter summary
- All HTML elements can have attributes .
alt
The attribute provides text for readers.href
The attribute specifies the URL of the link.lang
The attribute sets the language of the document.src
The attribute specifies the source url.src
The attribute specifies the source url.