Skip to content

Instantly share code, notes, and snippets.

View bramstein's full-sized avatar

Bram Stein bramstein

View GitHub Profile
@bramstein
bramstein / subpixel-word-spacing-detect.js
Last active September 5, 2015 07:34
Detect sub-pixel word- and letter-spacing.
var subpixelWordSpacing = false;
if (document.defaultView && document.defaultView.getComputedStyle) {
// Store the original word spacing on the document element
var originalWordSpacing = document.defaultView.getComputedStyle(document.documentElement, null).wordSpacing;
// Set the word-spacing to half a pixel
document.documentElement.style.wordSpacing = '0.5px';
// This will return either 0px or 1px if sub-pixel word-spacing is not supported, otherwise