Single, Double, and Curly Quotes

Thursday, February 28, 2019
Tag: technical

Here are my opinions on when you should use different kinds of quotation marks in code and prose.

Single-Quotes

Efficiency and clean looks matter most with programming languages (Python, JavaScript, etc.). Use single quotes here.

// JavaScript
alert('Hello, world!');
// CSS/Sass
@import 'partials/breakpoints';

Note the 'example' within the Django code block nested in HTML here:

<!-- HTML/Django template -->
<a href="{% url 'example' example.id %}">{{ example.id }}</a>

Double-Quotes

HTML should use double-quotes. It’s more public (view source), so it should feel a little more official. HTML feels old fashioned in a way that befits double quotes.

<img src="http://example.com/fish.png" alt="A fish" />

Curly-Quotes

Any text intended solely for reading should use proper curly quotes.

“Dodging and burning are steps to take care of mistakes God made in establishing tonal relationships.”

Ansel Adams

“Life is full of pain. Let the pain sharpen you, but don’t hold on to it. Don’t be bitter.”

Trevor Noah