Self-closing tags general question

Hi there!

I have a general question about self-closing tags in HTML. I’m wondering why some elements need to have an opening and closing tag while others are self-closing. For example, the “img” and “video” elements seem quite similar to me, however, one is self-closing while the other is not. I thought self-closing elements were those without content (like line break), but “img” does have content.

Does anyone know? :slight_smile:


A self-closing tag is sometimes referred to as a void element, meaning it contains nothing. Self-closing tags have only their attributes, and no content.

<video></video> is an element that may contain textual content such as,

Your device does not support video

It refers to content, but does not have any of its own renderable content. The content is brought down via the src attribute.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.