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 How to Make a Website Creating HTML Content Structure the Image Gallery

Gianluca Maio
Gianluca Maio
9,128 Points

Way to self-close the tags

Shouldn't the self-closing tags have a backslash char before the closing bracket? Like this:

<img src="PATH" alt"" />

I am aware that it is a requirement of an XHTML well-structured document. Does this mean that this rule has been dropped in HTML5?

2 Answers

Joseph Zimmerman
Joseph Zimmerman
6,402 Points

Yes, you can get away with leaving the / off your self closing tags.

Bryce Santos
Bryce Santos
11,157 Points

Yep, so basically both

<br>

is acceptable and

<br />

works as well in HTML5