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 trialAbhishek Neogi
Front End Web Development Techdegree Student 995 PointsTo add /> or to not add /> for standalone (no-pair) HTML tags?
I've noticed that in some tags Sir Nick uses the /> token to close the tag. The tags that don't come with pairs.
For example: <img src=""/>
whereas for certain tags such as link tags <link rel="" type="" href=""> he does not add that '/' character before ending the tag.
Is that just a formality or matter of preference or is that some kind of rule to follow?
I added the <link rel="" type="" href="" /> though.
1 Answer
Steven Parker
231,248 PointsThat's just a notation for a stand-alone tag.
The slash before the closing angle indicates that the tag is complete, and will have no content or paired end tag. This is generally optional in HTML, but it is required for XHTML.