Skip to content

Instantly share code, notes, and snippets.

@gunnarbittersmann
Last active August 29, 2015 14:17
Show Gist options
  • Select an option

  • Save gunnarbittersmann/0632cb3f86caa872d3eb to your computer and use it in GitHub Desktop.

Select an option

Save gunnarbittersmann/0632cb3f86caa872d3eb to your computer and use it in GitHub Desktop.
Flexbox
/**
* Flexbox
*/
* { box-sizing: border-box }
section
{
display: flex;
flex-wrap: wrap;
justify-content: space-between;
}
#div1
{
background: hsl(0,60%,40%);
flex-basis: 2em;
flex-grow: 1;
}
#div2
{
background: hsl(50,60%,40%);
flex-basis: 4em;
flex-grow: 1;
}
#div3
{
background: hsl(100,60%,40%);
flex-basis: 2em;
flex-grow: 1;
}
#div4
{
background: hsl(150,60%,40%);
flex-basis: 4em;
flex-grow: 1;
max-width: 6em;
}
#div5
{
background: hsl(200,60%,40%);
}
#div6
{
background: hsl(250,60%,40%);
}
#div7
{
background: hsl(300,60%,40%);
flex-grow: 1;
}
div
{
margin: 0.1em;
padding: 0.5em;
color: white;
font: normal 4em/1 "Helvetica Neue", Helvetica, Arial, sans-serif;
}
div:nth-child(odd) { background: #a40 }
div:nth-child(even) { background: #048 }
<section>
<div id="div1">1</div>
<div id="div2">2</div>
<div id="div3">3</div>
<div id="div4">4<br/>4</div>
<div id="div5">5</div>
<div id="div6">6</div>
<div id="div7">7</div>
</section>
// alert('Hello world!');
{"view":"split","fontsize":"100","seethrough":"","prefixfree":"1","page":"css"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment