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
Rhonda Bradley
2,010 PointsWhen is the slash used with self-contained carrots? /> vs >
Hi, In my html class when we used self-contained carrots (<blahblahblah> vs. <blah></blah>), the phrase was closed with a simple ending carrot as opposed to slash-carrot.
I noticed in this lesson that the canonical rule on duplicate pages is closed with a slash-carrot.
Could someone please tell me why this is? Is is a different html version, or is it standard with these type of canonical links?
Thanks very much for any input you might have!
4 Answers
Christopher Loyd
Courses Plus Student 5,806 PointsFor self-closing tags, the / prior to the closing sign in HTML5 is optional. It will work either included or not included.
In HTML4 the / prior to the closing sign was technically invalid, but many browsers and validators supported it and gave the coder some leniency.
Jonathan Grieve
Treehouse Moderator 91,254 PointsI tend to use them when i'm not sure as they're recognised and highlighted in my text editor as self closing tags. :-)
Rhonda Bradley
2,010 PointsThank you very much, that clears it up!
Frederico Graciano
Courses Plus Student 2,768 Points<b>it's good to always use it.</b>