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 trialCory Davis
1,208 PointsIs there a reason to use single quotes (') vs. double quotes (") when using the attribute selector?
He does both in the video.
For example, is there any difference between:
input[type='submit']:active { background-color: red; }
AND
input[type="submit"]:active { background-color: red; }
?
3 Answers
Steven Parker
231,269 PointsBoth styles of quotes work the same, but they need to be used in matched pairs.
James Norberto
765 PointsI used to use single quotes, then later read double quotes were the norm. I view Treehouse as the gold standard of development - the instructor used single quotes ...
Is single quotes preferred?
Steven Parker
231,269 PointsThe only "best practice" is to be consistent with whichever you choose, there's no preference for one style over the other.
James Norberto
765 PointsThanks Steven! It'd be easier if one was preferred, lol.
Steven Parker
231,269 PointsWell, Google's style guide recommends apostrophes (single quotes) for CSS.
Cory Davis
1,208 PointsCory Davis
1,208 PointsThank you!