Skip to content

Instantly share code, notes, and snippets.

@moladukes
Last active August 29, 2015 14:19
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 moladukes/4f28a4e3ea1ebd63bb7c to your computer and use it in GitHub Desktop.
Save moladukes/4f28a4e3ea1ebd63bb7c to your computer and use it in GitHub Desktop.
Simple Fluid Grid with responsive font sizing
// Responsive text sizing
html {
@media (min-width: 768px) {
font-size: 62.5%;
}
@media (max-width: 767px) {
font-size: 52.5%;
}
@media (max-width: 504px) {
font-size: 42.5%;
}
}
body {
text-shadow: none;
font-style: normal;
text-transform: normal;
font-size: 1.4rem;
line-height: 1.625;
font-weight: 400;
color: #222;
-webkit-font-smoothing: subpixel-antialiased;
}
h1, h2, h3, h4 {
margin-top: 0;
font-weight: 300; }
h1 { font-size: 4.0rem; line-height: 1.2; }
h2 { font-size: 3.6rem; line-height: 1.25; }
h3 { font-size: 3.0rem; line-height: 1.3; }
h4 { font-size: 2.4rem; line-height: 1.35; }
h5 { font-size: 1.8rem; line-height: 1.5; }
h6 { font-size: 1.5rem; line-height: 1.6; }
.row {
display: block;
@include box-sizing(border-box);
.col {
display: block;
float: left;
max-width: 100%;
@include box-sizing(border-box);
}
// -- Col Sizes
.col-1 {
width: 8.333333333%;
}
.col-2 {
width: 16.666666667%;
}
.col-3 {
width: 25%;
}
.col-4 {
width: 33.3333333333%;
}
.col-5 {
width: 41.6666666666%;
}
.col-6 {
width: 49.7777777778%;
}
.col-7 {
width: 58.333333333%;
}
.col-8 {
width: 66.666666667%;
}
.col-9 {
width: 75%;
}
.col-10 {
width: 83.333333333%;
}
.col-11 {
width: 91.666666667%;
}
.col-12 {
width: 100%;
}
// -- Auto clearfix .row
&:before,
&:after {
content: " ";
display: table;
}
&:after {
clear: both;
}
// -- Center row
&.row-center > .col {
float: none;
margin: 0 auto;
min-width: 560px;
}
}
// MOZILLLA PERCENT ROUNDING GRID FIX
@-moz-document url-prefix() {
.row {
.col-5 {
width: 41.11111112%;
}
@media (max-width: 502px) {
.col-5 {
width: 40%;
}
}
}
}
// Vertical align cols
.row.v-align {
display: table;
width: 100%;
.col {
display: inline-block;
vertical-align: middle;
float: none;
}
}
// Grid Responsive
@media (max-width: 768px) {
.row .col.col-xl,
.row.row-xl .col {
float: none;
width: auto;
}
.row .col-x6 {
width: 49.7777777778%;
}
.row.row-center > .col {
min-width: 0;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment