惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Google DeepMind News
Google DeepMind News
C
CERT Recently Published Vulnerability Notes
C
Cisco Blogs
Cloudbric
Cloudbric
The Last Watchdog
The Last Watchdog
L
LINUX DO - 热门话题
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Application and Cybersecurity Blog
Application and Cybersecurity Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Security Archives - TechRepublic
Security Archives - TechRepublic
TaoSecurity Blog
TaoSecurity Blog
V2EX - 技术
V2EX - 技术
H
Heimdal Security Blog
S
Security Affairs
L
Lohrmann on Cybersecurity
Hacker News - Newest:
Hacker News - Newest: "LLM"
Simon Willison's Weblog
Simon Willison's Weblog
WordPress大学
WordPress大学
小众软件
小众软件
Security Latest
Security Latest
AWS News Blog
AWS News Blog
Apple Machine Learning Research
Apple Machine Learning Research
GbyAI
GbyAI
Engineering at Meta
Engineering at Meta
阮一峰的网络日志
阮一峰的网络日志
罗磊的独立博客
F
Full Disclosure
S
Schneier on Security
L
LangChain Blog
MyScale Blog
MyScale Blog
Know Your Adversary
Know Your Adversary
P
Privacy International News Feed
Google Online Security Blog
Google Online Security Blog
Scott Helme
Scott Helme
Stack Overflow Blog
Stack Overflow Blog
爱范儿
爱范儿
A
Arctic Wolf
Martin Fowler
Martin Fowler
B
Blog RSS Feed
大猫的无限游戏
大猫的无限游戏
博客园 - 三生石上(FineUI控件)
The Register - Security
The Register - Security
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
博客园_首页
Latest news
Latest news
F
Fortinet All Blogs
G
GRAHAM CLULEY
T
The Exploit Database - CXSecurity.com
Hacker News: Ask HN
Hacker News: Ask HN

CSS Wizardry

Front-End’s Missing Metric: The TBT Window Meet Your Users Where They Are with Obs.js Better Browser Caching with No-Vary-Search font-family Doesn’t Fall Back the Way You Think What Is CSS Containment and How Can I Use It? When All You Can Do Is All or Nothing, Do Nothing Obs.js: Context-Aware Web Performance for Everyone Low- and Mid-Tier Mobile for the Real World (2025) The Fastest Site in the Tour de France Making Sense of the Performance Extensibility API Why Do We Have a Cache-Control Request Header? HTML Is Not a Programming Language… Build for the Web, Build on the Web, Build with the Web Licensing Code on CSS Wizardry A Layered Approach to Speculation Rules Designing (and Evolving) a New Web Performance Score Core Web Vitals Colours The Ultimate Contract Templates for Tech Consultants: Protect Your Business and Get Paid Optimising for High Latency Environments Cache Grab: How Much Are You Leaving on the Table? blocking=render: Why would you do that?! Correctly Configure (Pre) Connections The Three Cs: 🤝 Concatenate, 🗜️ Compress, 🗳️ Cache What Is the Maximum max-age? How to Clear Cache and Cookies on a Customer’s Device The Ultimate Low-Quality Image Placeholder Technique Core Web Vitals for Search Engine Optimisation: What Do We Need to Know? The HTTP/1-liness of HTTP/2 In Defence of DOM­Content­Loaded Site-Speed Topography Remapped Why Not document.write()? Speeding Up Async Snippets Critical CSS? Not So Fast! Measure What You Impact, Not What You Influence Optimising Largest Contentful Paint Measuring Web Performance in Mobile Safari Site-Speed Topography Speed Up Google Fonts Real-World Effectiveness of Brotli Performance Budgets, Pragmatically Lazy Pre-Browsing with Prefetch Making Cloud.typography Fast(er) Time to First Byte: What It Is and How to Improve It Self-Host Your Static Assets Tips for Technical Interviews Cache-Control for Civilians Bandwidth or Latency: When to Optimise for Which ITCSS × Skillshare What If? CSS and Network Performance The Three Types of Performance Testing Getting to Know a Legacy Codebase Image Inconsistencies: How and When Browsers Download Images Identifying, Auditing, and Discussing Third Parties My Digital Music Setup Measuring the Hard-to-Measure Finding Dead CSS The Fallacies of Distributed Computing (Applied to Front-End Performance) Ten Years Old Relative Requirements Airplanes and Ashtrays Performance and Resilience: Stress-Testing Third Parties Refactoring Tunnels Little Things I Like to Do with Git Writing Tidy Code Configuring Git and Vim Base64 Encoding & Performance, Part 2: Gathering Data Base64 Encoding & Performance, Part 1: What’s Up with Base64? Code Smells in CSS Revisited Moving CSS Wizardry onto HTTPS and HTTP/2 Ack for CSS Developers A New Year, a New Focus Preparing Vim for Apple’s Touch Bar Choosing the Correct Average CSS Shorthand Syntax Considered an Anti-Pattern CSS Wizardry Newsletter Nesting Your BEM? Improving Perceived Performance with Multiple Background Images Continue Normalising Your CSS Pure CSS Content Filter Pragmatic, Practical, and Progressive Theming with Custom Properties Refactoring CSS: The Three I’s Speaker’s Checklist: Before and After Your Talk Improving Your CSS with Parker The Importance of !important: Forcing Immutability in CSS Mixins Better for Performance Managing Typography on Large Apps White October Events Workshop Partnership BEMIT: Taking the BEM Naming Convention a Step Further Travelling Like You Want to, When You Have To Contextual Styling: UI Components, Nesting, and Implementation Detail Subtleties with Self-Chained Classes Cyclomatic Complexity: Logic in CSS Immutable CSS Can CSS Be Too Modular? More Transparent UI Code with Namespaces When to use @extend; when to use a mixin The Specificity Graph CSS Wizardry Ltd.: Year 1 in review CSS Guidelines 2.0.0
Typography for Developers
Harry Roberts · 2017-02-07 · via CSS Wizardry

Written by on CSS Wizardry.

Table of Contents

Independent writing is brought to you via my wonderful Supporters.

  1. Ellipses
  2. Quotes
    1. Apostrophes
    2. Sixty-Sixes and Ninety-Nines
  3. Dashes
    1. Hyphens
    2. Minuses
    3. En Dashes
    4. Em Dashes

Since as long as I can remember, I’ve had a soft spot for typography, and when it makes up so much of the web, typography should be good. Learning how to design with type, and pair typefaces, is a skill unto itself, but the good news for us less design-minded developers is that there are a few simple rules we can follow to get guaranteed better looking text with almost zero effort. And if there’s one thing developers love, it’s rules.

Time and again I see mis-implemented type that could have been avoided simply by developers having a better appreciation for, and understanding of, some typographical nuance. Learn and memorise the rules in this article and you’ll find that your text will become much more harmonious and polished, and you won’t have designers bugging you about using the wrong type of dash…

Ellipses

Let’s start with the simplest one, the ellipsis. The ellipsis represents an omission or trailing of thought. It is a single glyph comprising three dots, like so:

To be continued…

Try highlighting the three dots: notice how there’s only one character there, not three? That because the ellipsis is not three separate period glyphs, and it most definitely isn’t a whole series of periods:

To be continued........

That isn’t a thing at all, so certainly never do that.

If you want to write an ellipsis character, you have a few options:

Mac Win HTML Output
Alt+; Alt+0133 …

Quotes

The quotes you find on your keyboard are ambidextrous, or dumb quotes. They are big, awful, clumsy, straight lines that look like wedges jammed into your text. They exist purely because of space constraints on modern keyboards: there just isn’t enough room to have left and right single- and double-quote marks, so instead we have quote marks that can do both.

'Single' and "double" dumb quotes. Ugly.

These are the kinds of quotes you’re used to writing in your code, and they’re fine there, but in any prose we want to make sure we use proper book quotes. Their purposefully designed shapes are much more sympathetic to the typeface, and are visually much less jarring:

‘Single’ and “double” book quotes. Beautiful.

Apostrophes

Apostrophes follow the same rule as quotes, and use the same glyph as a right single quote:

It's awful like this.

See how awkward and harsh that looks? Like it doesn’t belong?

It’s much nicer like this.

Mac Win HTML Output
Alt+] Alt+0145 ‘
Alt+Shift+] Alt+0146 ’

Sixty-Sixes and Ninety-Nines

When I was at school we were taught that opening quotes look like two sixes, 66, and that closing quotes look like two nines, 99. This likeness is much more apparent in serif faces:

“Sixty-sixes and ninety-nines.”

Mac Win HTML Output
Alt+[ Alt+0147 “
Alt+Shift+[ Alt+0148 ”

However, I seldom use double quotes. I share Jost Hochil’s sentiment that [a] more attractive appearance is achieved by using single quotation marks for the more frequently occurring quotations, and the double version for the less frequent occurrence of quotations within quotations.1

American English tends toward the use of “double quotes”, but I much prefer the less obtrusive appearance of ‘single quotes’. They look far more subtle in passages of text, and the best typography always goes unnoticed.

‘Sixes and nines.’


Dashes

Dashes are a whole chapter unto themselves. Again, as with the ambidextrous quotes, physical limitations on keyboards meant that we have just one catch-all key, the hyphen, that is often called upon to fulfil the role of all kinds of dash.

Hyphens

The hyphen on your keyboard is actually only useful for a small number of tasks. If you need a compound modifier (e.g. a light-green dress), a double barrelled name (e.g. Robert Bayden-Powell), or words split over two lines in justified text, you should use a hyphen. Pretty much everything else has a more specific type of dash that should be used.

Front-end Developer

Mac Win HTML Output
- - - -

Minuses

If you really want to show off, there’s technically a different character for minuses. A hyphen is a very close approximation, but is set a little lower and shorter than a true minus.

Your balance is £-1902.

Your balance is £−1902.

Use this in any math you need to write, or for displaying negative values. Unfortunately it’s a little harder (read, potentially impossible) to write out on a Mac.

Mac Win HTML Output
N/A Alt+2212 −

En Dashes

The en dash is a slightly longer dash used to denote ranges or relations, e.g.:

Refer to pages 88–93.

Father–son relationship.

It is typically, though not necessarily, half the width of the em dash.

Mac Win HTML Output
Alt+- Alt+0150 –

Em Dashes

The em dash is usually one em wide (hence the name), meaning that it would be 24 points wide in a 24pt font, 12pt wide in a 12pt font, and so on. It represents a change in thought, and is a slightly more elegant substitute for parenthesis.

It has been said—though I would say otherwise—that I’m something of a pedant.

It could also be used in place of a colon.

The three technical ingredients for responsive web design—fluid grids, flexible images, and media queries.

Mac Win HTML Output
Alt+Shift+- Alt+0151 —

Em dashes are usually set with no space between them and the adjoining character, however some people prefer to use an en dash set with spaces and avoid the em dash altogether. I’m not so much a fan of this approach as it can often look a little ambiguous, but let your decision be guided by your styleguide and/or the typeface.

Spaced en dashes – like these – can take the place of ems.

Hair Spaces

Again, if you’re feeling particularly fancy, you can set your em dashes with hair spaces ( ) either side of them.

Hair-spaced em dashes — like these — are pretty neat.

Mac Win HTML Output
N/A N/A   ] [

There’s plenty more out there to be learned, but for now I think that would make a great start. A few simple rules that drastically improve the quality of your text without you needing any real design knowledge.