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 trialTobias Edwards
14,458 PointsEmpty Elements General Question
Hello
Just quite a general question, both for the community and the developers of the series, shouldn't empty elements such as <img> and <meta> be <img /> and <meta />?
I know this style is not compulsory, but in the book I'm reading while learning from Treehouse: "HTML & CSS" by Jon Duckett, it teaches that empty elements are better written with a forward slash at the end, and otherwise is a bad habit.
What do you guys think?
Thank you for the fantastic tutorials, keep up the good work!
Tobias
1 Answer
Jonathan Grieve
Treehouse Moderator 91,253 PointsJust for clarity the elements we're talking about here are img and meta which are self closing tags
<img /> and <meta />?
Whether we should include the forward slash, I learn towards yes we should as it provides a clear separation between these and the rest of the tags in the specification. But if you are, be consistent, so add them for all self closing tags you use in your projects. :)