0

What is the difference between single or double quotes in my JS and CSS? Is it a matter of opinion, of are there specific situations where one is required over the other.

In W3Schools, they use single-quotes for url(''), but they use double quotes for font-face: "". Additionally, in a JavaScript tutorial I saw, they used both single and double quotes.

What's the difference?

Jeroen
  • 60,696
  • 40
  • 206
  • 339
user3327101
  • 171
  • 1
  • 3
  • 8
  • Prime = `'` and double prime = `"`. Apostrophes `‘`/`’` and quotation marks `“`/`”` are different. – Ming Feb 25 '14 at 08:20
  • I've taken the liberty of slightly rewording your question, because in its original form ("what's the best practice") it would probably get closed as "Primarily opinion based". In its current form ("is there a difference") it's a valuable question imho, and you seemed to be also wanting to know this. If you feel I've changed your question too much feel free to rollback my edit. – Jeroen Feb 25 '14 at 09:01
  • Come to think of it though, in its current form it's probably a duplicate of [this question](http://stackoverflow.com/q/242813/419956) – Jeroen Feb 25 '14 at 09:02

1 Answers1

5

The most important thing is to be consistent. Use the same quote style throughout the same project. If you enjoy writing JavaScript with single-quotes, please do. But If your teammate likes to use double-quotes, agree on what style to use before working.

Additional information:

Community
  • 1
  • 1
sshow
  • 8,820
  • 4
  • 51
  • 82