what is attributes in HTML?
An HTML attribute is an attribute that is written in the opening tag of an HTML element, and this attribute can affect the element or its content in a complete or relative way.
Before delving into the explanation, you should know that HTML attributes are divided into two types.
- global attribute
- element attribute
Global attribute in HTML:
global attribute You can use it in all HTML elements.
element attribute in HTML:
The attribute element cannot be used in all HTML elements, as it is an attribute for one element and not all elements.
How to write attribute in HTML?
The HTML attribute is written in the opening tag of the element immediately after the element name. The HTML attribute consists of a name and a value.
For example:
<tag attribute name = “attribute value”>Item content</tag>
note:
You can write the value of the attribute without putting it between two signs “” or ”, but if the value consists of two words, it is better to put it between one of the two signs.
You can also put the attribute value under the attribute name
For example:
<tag
attribute name
=
“attribute value “>
Item content
</tag>
Note: English is not my official language. Mostly I use Google Translate. Therefore, if you encounter a problem or find some errors, you can inform me of the error on the contact us page or comments, or go to Mozilla developer website to understand the lesson well.
Thank you for reading the article and do not forget to share it with friends