Skip to content

Instantly share code, notes, and snippets.

@jfmdev
Created May 8, 2024 01:36
Show Gist options
  • Save jfmdev/e3541b3d9e94866fe429b9baf89e6303 to your computer and use it in GitHub Desktop.
Save jfmdev/e3541b3d9e94866fe429b9baf89e6303 to your computer and use it in GitHub Desktop.
Flexbox utility classes
/* --- Display --- */
.flex {
display: flex;
}
.inline-flex {
display: inline-flex;
}
/* --- Basis / Grow / Shrink --- */
.flex-basis-0 {
flex-basis: 0;
}
.flex-basis-auto {
flex-basis: auto;
}
.flex-grow-0 {
flex-grow: 0;
}
.flex-grow-1 {
flex-grow: 1;
}
.flex-shrink-0 {
flex-shrink: 0;
}
.flex-shrink-1 {
flex-shrink: 1;
}
/* --- Direction --- */
.flex-column {
flex-direction: column;
}
.flex-column-inv {
flex-direction: column-reverse;
}
.flex-row {
flex-direction: row;
}
.flex-row-inv {
flex-direction: row-reverse;
}
/* --- Align --- */
.content-normal {
align-content: normal;
}
.content-center {
align-content: center;
}
.content-start {
align-content: flex-start;
}
.content-end {
align-content: flex-end;
}
.content-between {
align-content: space-between;
}
.content-around {
align-content: space-around;
}
.content-evenly {
align-content: space-evenly;
}
.content-baseline {
align-content: baseline;
}
.content-stretch {
align-content: stretch;
}
.items-start {
align-items: flex-start;
}
.items-end {
align-items: flex-end;
}
.items-center {
align-items: center;
}
.items-baseline {
align-items: baseline;
}
.items-stretch {
align-items: stretch;
}
.self-auto {
align-self: auto;
}
.self-start {
align-self: flex-start;
}
.self-end {
align-self: flex-end;
}
.self-center {
align-self: center;
}
.self-stretch {
align-self: stretch;
}
.self-baseline {
align-self: baseline;
}
/* --- Justify --- */
.justify-normal {
justify-content: normal;
}
.justify-start {
justify-content: flex-start;
}
.justify-end {
justify-content: flex-end;
}
.justify-center {
justify-content: center;
}
.justify-between {
justify-content: space-between;
}
.justify-around {
justify-content: space-around;
}
.justify-evenly {
justify-content: space-evenly;
}
.justify-stretch {
justify-content: stretch;
}
.justify-items-start {
justify-items: start;
}
.justify-items-end {
justify-items: end;
}
.justify-items-center {
justify-items: center;
}
.justify-items-stretch {
justify-items: stretch;
}
.justify-self-auto {
justify-self: auto;
}
.justify-self-start {
justify-self: start;
}
.justify-self-end {
justify-self: end;
}
.justify-self-center {
justify-self: center;
}
.justify-self-stretch {
justify-self: stretch;
}
/* --- Wrap --- */
.flex-nowrap {
flex-wrap: npwrap;
}
.flex-wrap {
flex-wrap: wrap;
}
.flex-wrap-inv {
flex-wrap: wrap-reverse;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment