Skip to content

Instantly share code, notes, and snippets.

@Kcko
Created June 8, 2021 11:03
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 Kcko/48a5a0ace2d77715ea40bb1c50684508 to your computer and use it in GitHub Desktop.
Save Kcko/48a5a0ace2d77715ea40bb1c50684508 to your computer and use it in GitHub Desktop.
/* https://jsbin.com/bofitujaho/2/edit?html,css,output */
* {
box-sizing: border-box;
}
div {
display: flex;
flex-wrap: wrap;
width: 100%;
border: 0px solid black;
gap: 20px;
border: 3px solid black;
}
span
{
background: red;
width: calc(25% - 15px);
/*
((pocet sloupcu - 1 ) * gap) / poctem sloupcu
*/
}
/* https://coryrylan.com/blog/css-gap-space-with-flexbox */
.emulated-flex-gap {
--gap: 12px;
display: inline-flex;
flex-wrap: wrap;
margin: calc(-1 * var(--gap)) 0 0 calc(-1 * var(--gap));
width: calc(100% + var(--gap));
}
.emulated-flex-gap > * {
margin: var(--gap) 0 0 var(--gap);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment