Skip to content

Instantly share code, notes, and snippets.

@laurakalbag
Created December 28, 2012 16:53
Show Gist options
  • Save laurakalbag/4399636 to your computer and use it in GitHub Desktop.
Save laurakalbag/4399636 to your computer and use it in GitHub Desktop.
Example of an article with varying widths, font-sizes and line-heights depending on the viewport width, written in Sass.
article {
font-size: 14px;
line-height: 25px;
h2 {
font-size: 18px;
padding-bottom: 15px;
}
@media only screen and (min-width: 300px) {
line-height: 20px;
width: 90%;
h2 {
padding-bottom: 10px;
}
}
@media only screen and (min-width: 600px) {
line-height: 25px;
width: 80%;
h2 {
padding-bottom: 15px;
}
}
@media only screen and (min-width: 900px) {
width: 60%;
}
@media only screen and (min-width: 1200px) {
font-size: 16px;
line-height: 30px;
width: 50%;
h2 {
font-size: 21px;
line-height: 35px;
padding-bottom: 20px;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment