Source Code:
(back to article)
Submit
Result:
Report an issue
<!DOCTYPE html> <html> <head> <title>Title of the document</title> <style> .box { width: 460px; height: 70px; display: flex; } .box div { flex-grow: 0; flex-shrink: 0; flex-basis: 70px; padding: 15px; /* For Safari 6.1 and above browsers */ -webkit-flex-grow: 0; -webkit-flex-shrink: 0; -webkit-flex-basis: 70px; } .box div:first-child { background-color: #40c3da; } .box div:nth-of-type(2) { flex-basis: 100px; -webkit-flex-basis: 100px; background-color: lightgreen; } .box div:nth-of-type(3) { background-color: #1c87c9; } .box div:nth-of-type(4) { flex-basis: 150px; -webkit-flex-basis: 150px; background-color: orange; } .box div:nth-of-type(5) { background-color: #8ebf42; } </style> </head> <body> <h2>Flex-basis property example</h2> <div class="box"> <div> 70px </div> <div> 100px </div> <div> 70px </div> <div> 150px </div> <div> 70px </div> </div> </body> </html>