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 trialIsaac Johnson
2,451 Points" vs. '
I noticed on the image displayed in the video when describing the <figcaption> element, he used <img src='joel.jpg' alt='Cool Joel'>
Up to this point I have been using " and not ' . Is there a time when I use one or not the other? Will they register the same? Is there a best practice or do we just aim for consistency?
1 Answer
Steven Parker
231,122 PointsEither character can serve to enclose a string in HTML, and there's no functional difference. But your choice may be influenced by the content of the string. If the string contains one of those characters, using the other one to enclose the string can avoid the need to "escape" any characters. Examples:
<button title="Don't click this!">PANIC</button>
<img src="george.jpg" alt='George "Mojo" Atkins'>