flexbox_flex-basis.html (779B)
1 <!DOCTYPE html> 2 <title>flexbox | flex-basis: percentage</title> 3 <link rel="author" href="http://opera.com" title="Opera Software"> 4 <link rel="help" 5 href="http://www.w3.org/TR/css-flexbox-1/#flex-basis-property"> 6 <link rel="match" href="flexbox_flex-basis-ref.html"> 7 <style> 8 div { 9 background: blue; 10 margin: 1em 0; 11 border: 1px solid black; 12 height: 8em; 13 width: 8em; 14 15 display: flex; 16 } 17 span { 18 background: white; 19 margin: 1em 0; 20 width: 5em; 21 display: inline-block; 22 23 flex-grow: 1; 24 flex-shrink: 0; 25 flex-basis: 100%; 26 } 27 span:nth-child(1) {background: yellow;} 28 span:nth-child(2) {background: pink;} 29 span:nth-child(3) {background: lightblue;} 30 span:nth-child(4) {background: grey;} 31 </style> 32 33 <div> 34 <span>one</span> 35 <span>two</span> 36 <span>three</span> 37 <span>four</span> 38 </div>