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 trialChris Jones
4,521 PointsHTML code challenges
Not sure anyone addressed this in the past but when coding the challenges the backslashes are inverted for windows users. So when coding images in the code, windows users have to "code it wrong" to get the correct results. Is that right?
<img src="img/featured-cupcake.jpg">
<img src="img\featured-cupcake.jpg">
1 Answer
Mario Blokland
19,750 PointsEvery user has to code in the same form in this case. It does not depend on what OS you are running. So this
img src="img/featured-cupcake.jpg"
is right. Don't forget to close the quotes like you did in your example ;).
Chris Jones
4,521 PointsChris Jones
4,521 PointsThanks I just have to remember that it's different when I'm taking notes to make the page work on my own vs coding in the code challenges.
Mario Blokland
19,750 PointsMario Blokland
19,750 PointsEven when you are working and testing on your own computer you should use the same way as explained. If you would be in the command prompt on windows and were searching, copying etc. you would use the backslash.
But in this case you tell your browser in which path he has to look for. Not Windows.
So this "/" is always right in HTML
Chris Jones
4,521 PointsChris Jones
4,521 PointsUnless referencing image paths then you have to invert for windows.
Mario Blokland
19,750 PointsMario Blokland
19,750 PointsIt shouldn't. You should always use the forwarded slash:
"The generic syntax uses the slash ("/"), question mark ("?"), and number sign ("#") characters to delimit components that are significant to the generic parser's hierarchical interpretation of an identifier."
source = http://tools.ietf.org/html/rfc3986#section-1.2.3
I could be wrong but I am pretty sure I am right :-)
Chris Jones
4,521 PointsChris Jones
4,521 PointsGot it. It's just confusing if you are attempting to locate the image source in windows and copy paste and all you get are "\". So from the documentation the slashes are interchangeable so windows won't malfunction if I just use / all the time. Thanks.
Mario Blokland
19,750 PointsMario Blokland
19,750 PointsYou are welcome :-)