0
Why are some tags self-closing whereas others are not?
<img> <br> are self -closing but <video> isn't !
2 ответов
+ 4
Tags that needs a closing tag works as container for other self closing and non self closing tags.
For example, div needs a closing tag so it can contain other div or img tags
<div>
<p>Closing tag</p>
<img src="img.jpg">
<div>
+ 3
It depends upon usage of tag....
img have limited attribute and it only use to display images, and br tag is not for line break, there and requirement to put any content in them....
But vedio have various source for different extension of vedio which are it's content and it also have attribute like control, loop etc....
In short,
If tag needs content to display, it will have ending tag....
else if it have attribute, then it will be self closing tag.....