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 trialStacy Fabian
2,246 Pointsimg source notation clarification
So in here it only tells me to note an image as...
<img src="http://i.istockimg.com/file_thumbview_approve/579702/2/stock-illustration-579702-little-hot-chick.jpg">
But I'm in another site required for my school application (codecademy) and says to add a a / before closing the tag so...
<img src="http://i.istockimg.com/file_thumbview_approve/579702/2/stock-illustration-579702-little-hot-chick.jpg" />
They both seem to work so I assume it's just a semantics thing, but which one is considered industry standard?
Thanks!
2 Answers
Charles Loges IV
8,022 PointsStacy,
I have seen done both ways. the /> method from what I understand is the older way of doing things going back to XHTML where the syntax is more strict and all tags most have a closing tag. The W3C uses examples without the backslash. I believe this is because in HTML there is no such requirement.
<img src="img/picture.jpg">
Stacy Fabian
2,246 PointsThanks Guys!
Jason Anello
Courses Plus Student 94,610 PointsJason Anello
Courses Plus Student 94,610 PointsYes, it was a requirement I believe with xhtml but it is optional in html.