Skip to content

Instantly share code, notes, and snippets.

@alixaxel
Created December 13, 2011 17:24
Show Gist options
  • Save alixaxel/1473016 to your computer and use it in GitHub Desktop.
Save alixaxel/1473016 to your computer and use it in GitHub Desktop.
4 Columns - Fixed, Fluid & Padded Grid
.grid {
margin: 0 auto;
width: 960px;
._01 {
width: 960px / 4 * 1 - 2 * 10px;
}
._02 {
width: 960px / 4 * 2 - 2 * 10px;
}
._03 {
width: 960px / 4 * 3 - 2 * 10px;
}
._04 {
width: 960px / 4 * 4 - 2 * 10px;
}
._01, ._02, ._03, ._04 {
display: inline;
float: left;
margin: 0 10px;
/*position: relative;*/
&.alpha {
margin-left: 0;
}
&.omega {
margin-right: 0;
}
}
}
//@import '02_fluid.less';
//@import '03_padded.less'
.grid {
width: 96%;
._01 {
width: 100% / 4 * 1 - 2 * 1%;
}
._02 {
width: 100% / 4 * 2 - 2 * 1%;
}
._03 {
width: 100% / 4 * 3 - 2 * 1%;
}
._04 {
width: 100% / 4 * 4 - 2 * 1%;
}
._01, ._02, ._03, ._04 {
margin: 0 1%;
> ._01 {
width: 25% - 2 * 1%;
&.alpha, &.omega {
width: 25% - 1 * 1%;
}
}
> ._02 {
width: 50% - 2 * 1%;
&.alpha, &.omega {
width: 50% - 1 * 1%;
}
}
> ._03 {
width: 75% - 2 * 1%;
&.alpha, &.omega {
width: 75% - 1 * 1%;
}
}
> ._04 {
width: 100%;
}
}
}
.grid {
._01 {
width: 100% / 4 * 1;
}
._02 {
width: 100% / 4 * 2;
}
._03 {
width: 100% / 4 * 3;
}
._04 {
width: 100% / 4 * 4;
}
._01, ._02, ._03, ._04 {
margin: 0;
padding: 0 10px;
-moz-box-sizing: border-box;
&.alpha {
padding-left: 0;
}
&.omega {
padding-right: 0;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment