Skip to content

Instantly share code, notes, and snippets.

@qutek
Created June 23, 2022 13:28
Show Gist options
  • Save qutek/dcc72a707b40671eeab4a99472ef9299 to your computer and use it in GitHub Desktop.
Save qutek/dcc72a707b40671eeab4a99472ef9299 to your computer and use it in GitHub Desktop.
[Super Simple Responsive CSS] Simple css for responsive layout with flex #css
.container {
margin: 0 auto;
max-width: 980px;
min-width: 320px;
}
.row {
display: flex;
flex-wrap: wrap;
}
.column {
text-align: center;
flex-grow: 1;
flex-shrink: 1;
flex-basis: 1;
margin: 10px;
padding: 10px;
}
.start {
-webkit-box-pack: start;
-ms-flex-pack: start;
justify-content: flex-start;
text-align: start;
}
.center {
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
text-align: center;
}
.end {
-webkit-box-pack: end;
-ms-flex-pack: end;
justify-content: flex-end;
text-align: end;
}
.top {
-webkit-box-align: start;
-ms-flex-align: start;
align-items: flex-start;
}
.middle {
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
}
.bottom {
-webkit-box-align: end;
-ms-flex-align: end;
align-items: flex-end;
}
.col-1 {
max-width: calc(100% / 12);
}
.col-2 {
max-width: calc(100% / 12 * 2);
}
.col-3 {
max-width: calc(100% / 12 * 3);
}
.col-4 {
max-width: calc(100% / 12 * 4);
}
.col-5 {
max-width: calc(100% / 12 * 5);
}
.col-6 {
max-width: calc(100% / 2);
}
@media screen and (max-width: 768px) {
.container {
overflow: auto;
}
.column {
min-width: 100%;
width: 100%;
margin: 10px 0;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment