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!
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
Jentry J1,821 Points
This wasn't covered in the video, doest it matter if you add a closing bracket to self-closing elements?
Just curious if it really matters that it's self-closing, and if I added a closing bracket if it would actually effect the code?
** I will be attempting to try this on my own, but wanted to leave this for any other curious folks.
Steven Parker228,025 Points
If you mean "end tag" then yes, it would be a syntax error.
For example, if you wrote this:
<img src="dog.jpg" alt=""></img>
That's not valid HTML. But browsers generally ignore the spurious end tag, so trying this out may not generate any errors or unexpected rendering effects.
The break take used to just be <br> but with the standards of xhtml they came out with <br /> which basically added a / at the end of any self closing tags such as the line break. Browsers probably still remember how to handle things without the / at the end but it's bad form to do that now a days.