Skip to content

Instantly share code, notes, and snippets.

@deepfriedfilth
Last active Apr 10, 2020
Embed
What would you like to do?
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