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
Suli S
1,475 Points<element> or <element />
Hi
In the HTML course all void elements were without the self-closing tag (the forward slash). However, in some CSS videos I noticed the self-closing tags! So which one should I use now?
5 Answers
Peaches Stubbs
21,320 PointsThe second one, there is no need for the slash.
Jonathan Schneider
2,686 Pointssorry i can't post inline code. please look at the link at post 2.
http://stackoverflow.com/questions/3558119/are-self-closing-tags-valid-in-html5
James Barnett
39,199 PointsJonathan Schneider - Check out this thread on how to post code in the forum
Suli S
1,475 PointsStill don't know which one should I choose
this:
<img src="image.jpg" alt="" />
or this
<img src="image.jpg" alt="">
Peaches Stubbs
21,320 PointsWith the example that you have posted , let's say that you were using the 'span' element. The opening would look like <span>, the closing would be </span>.
Giving you <span></span>. As opening and closing tags for the ''span" element.
James Barnett
39,199 PointsPeaches Newbold - The code for your span tags didn't show up. Check out this thread on how to post code in the forum
Peaches Stubbs
21,320 PointsThanks James i'll check it out.