What is the difference between html Element and Attribute?
Experience Level: Junior
Tags: HTML
Answer
The element consists of 3 parts:
- opening tag,
- content
- and closing tag
The opening tag can have zero or more attributes.
Each attribute consists of name and value.
Have a look at the following example:
If you break it down to separate parts:
- The whole block is element
- The
<p class="some-class" id="my-paragraph">
is the opening tag - The Some paragraph is the content
- The
</p>
is the closing tag - The
class="some-class"
is the first attribute where the attribute name is class and the attribute value is some-class - The
id="my-paragraph"
is the second attribute where the attribute name is id and the attribute value is my-paragraph
Related HTML job interview questions
What is a <div> tag?
HTML JuniorWhat is a basic structure of the HTML page?
HTML JuniorHow can you display HTML code of a web application?
HTML JuniorWhat is HTML used for?
HTML Junior
Chat
Oh, the operator is not available. Leave us your comments. We will answer all your questions as soon as possible.
Anonymous
Καλησπέρα.
Καλησπέρα.
Anonymous
the infinteis -3/15 so 1triition / infinet
the infinteis -3/15 so 1triition / infinet
Anonymous
e
e
Anonymous
<a href="https://inspirum.pl "
<a href="https://inspirum.pl "
Anonymous
[url]https://inspirum.pl[/url]
[url]https://inspirum.pl[/url]
LaceJaguar65
e
e
LaceJaguar65
e
e
LaceJaguar65
e
e
LaceJaguar65
e
e
LaceJaguar65
e
e
LaceJaguar65
e
e
LaceJaguar65
e
e
LaceJaguar65
e
e
LaceJaguar65
e
e
LaceJaguar65
e
e
LaceJaguar65
e
e
LaceJaguar65
e
e
LaceJaguar65
e
e
LaceJaguar65
e
e
LaceJaguar65
e
e
LaceJaguar65
e
e
LaceJaguar65
e
e
LaceJaguar65
e
e
LaceJaguar65
e
e
LaceJaguar65
e
e