Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

HTML

I thought the <img> tag wasn't supposed to be closed

At 2:02 Alena seems to be closing the <img> tag like this <img/>, I thought it was a syntax error and after some brief research I found out closing the <img> tag serves no purpose and is therefore forbidden. Does it actually serve any purpose here?

This is the link to the video BTW

1 Answer

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there! The img tag is a self-closing tag. It is forbidden to close it with an ending tag. For instance you may have this:

<img />

But you may not have this:

<img> </img>

But the last backslash is not absolutely necessary in the first example. For a really brilliant explanation, I recommend this blog post by the late Treehouse teacher Jason Seifer.

Hope this helps! :sparkles:

Solved my question, thx!