Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

HTML

Self Closing Tag

In this video, Nick shows the first example and states its a self closing tag. So when i used both examples on a page with the self closing tag first and the second one showing multiple sources, the page loads only up to the point of the first video. If i add a closing video tag, </video> then both videos will display.
Is Video a self closing tag as stated?

1 Answer

Michael Collins
Michael Collins
3,447 Points

The video tag is not self closing. Generally tags are self closing if they can't contain content between them. E.g. <input />, <br />, <hr /> etc.

However, the video tag can contain content e.g.

<video>
    <p>Your browser doesn't support HTML5 video.</p>
</video>

Therefore, without the closing tag, the browser doesn't know where the content belonging within the <video> tag ends and the rest of the page content begins.