Skip to content

Instantly share code, notes, and snippets.

@sandikodev
Forked from zuramai/base.css
Created November 5, 2020 21:22
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 sandikodev/98f9a01389a220f650eee4716404ee4b to your computer and use it in GitHub Desktop.
Save sandikodev/98f9a01389a220f650eee4716404ee4b to your computer and use it in GitHub Desktop.
Base Responsive Flex CSS Without Bootstrap
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
body {
font-family: 'Poppins';
}
.row {
margin: 0 -15px;
display:flex;
flex-wrap: wrap;
}
.row + .row {
margin-top: 15px;
}
[class*='col-'] {
padding: 0 15px;
}
.container {
width: 100%;
padding: 0 15px;
margin: 0 auto;
}
.col-1 { flex: none; width: calc(100% * 1 / 12) }
.col-2 { flex: none; width: calc(100% * 2 / 12) }
.col-3 { flex: none; width: calc(100% * 3 / 12) }
.col-4 { flex: none; width: calc(100% * 4 / 12) }
.col-5 { flex: none; width: calc(100% * 5 / 12) }
.col-6 { flex: none; width: calc(100% * 6 / 12) }
.col-7 { flex: none; width: calc(100% * 7 / 12) }
.col-8 { flex: none; width: calc(100% * 8 / 12) }
.col-9 { flex: none; width: calc(100% * 9 / 12) }
.col-10 { flex: none; width: calc(100% * 10 / 12) }
.col-11 { flex: none; width: calc(100% * 11 / 12) }
.col-12 { flex: none; width: calc(100% * 12 / 12) }
@media screen and (min-width: 768px) {
.container {
width: 720px;
}
.col-md-1 { flex: none; width: calc(100% * 1 / 12) }
.col-md-2 { flex: none; width: calc(100% * 2 / 12) }
.col-md-3 { flex: none; width: calc(100% * 3 / 12) }
.col-md-4 { flex: none; width: calc(100% * 4 / 12) }
.col-md-5 { flex: none; width: calc(100% * 5 / 12) }
.col-md-6 { flex: none; width: calc(100% * 6 / 12) }
.col-md-7 { flex: none; width: calc(100% * 7 / 12) }
.col-md-8 { flex: none; width: calc(100% * 8 / 12) }
.col-md-9 { flex: none; width: calc(100% * 9 / 12) }
.col-md-10 { flex: none; width: calc(100% * 10 / 12) }
.col-md-11 { flex: none; width: calc(100% * 11 / 12) }
.col-md-12 { flex: none; width: calc(100% * 12 / 12) }
}
@media screen and (min-width: 992px) {
.container {
width: 960px;
}
.col-lg-1 { flex: none; width: calc(100% * 1 / 12) }
.col-lg-2 { flex: none; width: calc(100% * 2 / 12) }
.col-lg-3 { flex: none; width: calc(100% * 3 / 12) }
.col-lg-4 { flex: none; width: calc(100% * 4 / 12) }
.col-lg-5 { flex: none; width: calc(100% * 5 / 12) }
.col-lg-6 { flex: none; width: calc(100% * 6 / 12) }
.col-lg-7 { flex: none; width: calc(100% * 7 / 12) }
.col-lg-8 { flex: none; width: calc(100% * 8 / 12) }
.col-lg-9 { flex: none; width: calc(100% * 9 / 12) }
.col-lg-10 { flex: none; width: calc(100% * 10 / 12) }
.col-lg-11 { flex: none; width: calc(100% * 11 / 12) }
.col-lg-12 { flex: none; width: calc(100% * 12 / 12) }
}
@media screen and (min-width: 1200px) {
.container {
width: 1140px;
}
.col-xl-1 { flex: none; width: calc(100% * 1 / 12) }
.col-xl-2 { flex: none; width: calc(100% * 2 / 12) }
.col-xl-3 { flex: none; width: calc(100% * 3 / 12) }
.col-xl-4 { flex: none; width: calc(100% * 4 / 12) }
.col-xl-5 { flex: none; width: calc(100% * 5 / 12) }
.col-xl-6 { flex: none; width: calc(100% * 6 / 12) }
.col-xl-7 { flex: none; width: calc(100% * 7 / 12) }
.col-xl-8 { flex: none; width: calc(100% * 8 / 12) }
.col-xl-9 { flex: none; width: calc(100% * 9 / 12) }
.col-xl-10 { flex: none; width: calc(100% * 10 / 12) }
.col-xl-11 { flex: none; width: calc(100% * 11 / 12) }
.col-xl-12 { flex: none; width: calc(100% * 12 / 12) }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment