Skip to content

Instantly share code, notes, and snippets.

@mattics
Last active December 11, 2015 12:28
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 mattics/4600397 to your computer and use it in GitHub Desktop.
Save mattics/4600397 to your computer and use it in GitHub Desktop.
A stripped down version of 4563625 which is non specific to bootstrap and easier to understand the concept due to lack of clutter.
@media (min-width: 1200px) {
.makeMyStyles(940px, 15px)
}
@media (max-width: 1199px) {
.makeMyStyles(768px, 12px)
}
.makeMyStyles(@width, @padding) {
.makeHalfWidthColumn() { // just an example mixin
width: @width / 2l
float: left;
}
.myContainer{width: @width; margin: 0 auto; }
.myInnerContent{ padding:@padding; width: @width - (@padding * 2); }
.myColumn { .makeHalfWidthColumn() }
}
//------------ CSS OUTPUT ------------//
@media (min-width: 1200px) {
.myContainer {
width: 940px;
margin: 0 auto;
}
.myInnerContent {
padding: 15px;
width: 910px;
}
.myColumn {
width: 470px;
float: left;
}
}
@media (max-width: 1199px) {
.myContainer {
width: 768px;
margin: 0 auto;
}
.myInnerContent {
padding: 12px;
width: 744px;
}
.myColumn {
width: 384px;
float: left;
}
}
//------------ CSS OUTPUT ------------//
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment