Skip to content

Instantly share code, notes, and snippets.

@pgarciacamou
Last active September 14, 2016 23:28
Show Gist options
  • Save pgarciacamou/9dcc83e79e0fafb31f0f2143d17f80d2 to your computer and use it in GitHub Desktop.
Save pgarciacamou/9dcc83e79e0fafb31f0f2143d17f80d2 to your computer and use it in GitHub Desktop.
Small old bootstrap grid system
$breakpoints: 700px, 900px, 1100px, 1300px;
$sizes: "sm", "md", "lg", "xl";
$cols: 12;
.clearfix {
clear: both;
}
.row {
position: relative;
display: inline-block;
width: 100%;
@extend .clearfix;
}
.col {
position: relative;
float: left;
width: 100%;
}
@for $i from 1 through length($breakpoints) {
$bp: nth($breakpoints, $i);
$s: nth($sizes, $i);
@media (min-width: $bp) {
@for $col from 1 through $cols {
.col-#{$s}-#{$col} {
width: 100% / ($cols/$col);
}
}
}
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<div class="row">
<div class="col col-sm-3">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</div>
<div class="col col-sm-3">
2
</div>
<div class="col col-sm-3">
3
</div>
<div class="col col-sm-3">
4
</div>
</div>
<!-- <div class="clearfix"></div> -->
<div class="col col-sm-6 col-md-2">
5
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment