Skip to content

Instantly share code, notes, and snippets.

@MartinMuzatko
Last active August 29, 2015 14:04
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 MartinMuzatko/53620fca0fc26150096b to your computer and use it in GitHub Desktop.
Save MartinMuzatko/53620fca0fc26150096b to your computer and use it in GitHub Desktop.
Responsive with ems
/*
Imagine a setup of a two-column website
of course - you have to adapt the CSS to your needs.
PROs:
your responsive layout is adaptive to the font, not any arbitrary pixels.
You have control about the font, not about the pixels.
main.group
#########################################################
# # #
# nav # section #
# # #
# # #
# # #
# # #
# # #
# # #
# # #
# # #
#########################################################
*/
main
{
margin: 0 auto;
width: 70%;
}
nav
{
width: 20%;
}
section
{
width: 80%
max-width: 35em;
}
@media (max-width: 80rem)
{
section
{
width: 60%;
}
}
@media (max-width: 60rem)
{
section
{
width: 80%;
max-width: 40em;
}
}
@media (max-width: 50rem)
{
section
{
width: 95%;
}
}
/* TOOLBELT - FLOAT CONTAINMENT & CLEARING */
.group
{
zoom: 1;
}
.group:after
{
clear: both;
}
.group:before,
.group:after
{
display: table;
}
.group > *
{
float: left;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment