Skip to content

Instantly share code, notes, and snippets.

@deepfriedfilth
Last active April 10, 2020 18:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deepfriedfilth/9461a5402aac593df37d619060d0135a to your computer and use it in GitHub Desktop.
Save deepfriedfilth/9461a5402aac593df37d619060d0135a to your computer and use it in GitHub Desktop.
Add legibility to old school website content with minimal CSS
function addStyles() {
document.body.style.margin = '50px auto';
document.body.style.maxWidth = '38em'; // 680px
document.body.style.fontSize = '18px';
document.body.style.lineHeight = '1.4';
document.body.style.wordBreak = 'break-word';
document.body.style.hyphens = 'auto';
}
if(!document.querySelector('link') || !document.querySelector('style')) { // no link/style tags
addStyles();
}
body {
margin: 50px auto;
max-width: 38em; /* 680px; */
font-size: 18px;
line-height: 1.4;
word-break: break-word;
hyphens: auto;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment