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

HTML How to Make a Website Customizing Colors and Fonts Pick Fonts and Set Relative Units

Single quotes vs double quotes font family why the difference?

At around the 3:30 mark in the video Nick enters in the font-family: 'font name' and only puts single quotes around the name.

But for other things like links, class & id's we have been using double quotes ("). how come i use (') for font family.

class="" href="" id="" font-family:' '

is that just the rule???

3 Answers

Shawn Rieger
Shawn Rieger
9,916 Points

You can use either. It's not a rule no. You should try to stay consistent though when your coding! I don't think he did it for any specific reason.

Tianni Myers
Tianni Myers
10,453 Points

Shawn is right, I think you can use either in HTML. But for other languages like PHP and I think JS, single quotes are strings and doubles are values.

Shawn Rieger
Shawn Rieger
9,916 Points

Actually, you can use either or in both languages. PHP basic string is single quotes while double quotes can be a generic string or process variables inline among other things. Check out

https://stackoverflow.com/questions/3446216/what-is-the-difference-between-single-quoted-and-double-quoted-strings-in-php#3446286

Likewise JavaScript you can use either single or double. It's the developer's preference. Just try to be consistent. With ES6 you can use back-ticks `` and do stuff like `Hello ${name}! Welcome!`

Thanks for the taking the time to post