+ 2
what is the difference between element and attribute
4 Réponses
+ 2
Elements are made up of opening tags, closing tags, and content between them e.g.
<p>this whole line is an element</p>
Attributes, on the other hand can be seen as additional settings for elements e.g
<p color="red">The opening tag has an attribute that changes this text to red</p >
Attributes can be distinguished quite easily. They'll have a name e.g color or src. ..followed by an equals sign and a value enclosed in quotation marks.
+ 1
<h1> is a tag.
"<h1>Some Heading</h1>" is an html element.
Some "lonely" tags are elements on their own. Like <br /> and <hr /> for example.
+ 1
An attribute is something you assign to an element to make it behave a certain way.
- 1
element like <h>
attribute you add in the element
<img src=_____>
img is element
src is attribute