Skip to content

Instantly share code, notes, and snippets.

@barnabywalters
Created September 5, 2012 19:22
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 barnabywalters/3642984 to your computer and use it in GitHub Desktop.
Save barnabywalters/3642984 to your computer and use it in GitHub Desktop.
em based responsive line lengths with cascading breakpoints and stuff
/*
* The basic idea:
* No more "mobile first", just take up the entire browser width when
* optimum line length gets near viewport width.
*/
body
{
width: 100%;
}
@media only screen and (min-width: 47em) {
body
{
width: 44em;
max-width: 100%;
margin: 17px auto; /* Centre the body */
padding: 20px;
}
}
/* The idea: Specify *everything* with ems (text-centric units) 'cos most content on the web is text */
/* Usage:
* Try loading http://test.waterpigs.co.uk and make the text very very big.
* Only really works in FF at the mo, but webkit works if you persuade it
* to redraw by fiddling with the window width
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment