HTML CSS examples for CSS Layout:Flex Width
Same width for child elements of flex items
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> .container {<!-- w w w. j a v a2s . c om--> display: flex; height: 100px; border: 1px solid red; } .item { display: flex; justify-content: center; flex: 1; border: 1px solid gray; margin: 2px; } .item:nth-child(2) { flex-direction: column; flex-grow: 2; text-align: center; border: none; margin: 0; } .item2 { flex: 1; border: 1px solid gray; margin: 2px; } .container-inner2 { display: flex; flex: 1; } .item3 { flex: 1; border: 1px solid gray; margin: 2px; } </style> </head> <body> <div class="container"> <div class="item"> azerty (.item) </div> <div class="item"> <div class="item2"> azerty (.item2) </div> <div class="container-inner2"> <div class="item3"> azerty (.item3) </div> <div class="item3"> azerty (.item3) </div> </div> </div> <div class="item"> azerty (.item) </div> </div> </body> </html>