Last active
April 10, 2020 18:11
-
-
Save deepfriedfilth/9461a5402aac593df37d619060d0135a to your computer and use it in GitHub Desktop.
Add legibility to old school website content with minimal CSS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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