Show Output
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Example of CSS3 Three Equal Flex Column Layout</title> <style> .flex-container { width: 80%; min-height: 300px; margin: 0 auto; font-size: 32px; display: -webkit-flex; /* Safari */ display: flex; /* Standard syntax */ border: 1px solid #808080; } .flex-container div { padding: 10px; background: #dbdfe5; -webkit-flex: 1; /* Safari */ -ms-flex: 1; /* IE 10 */ flex: 1; /* Standard syntax */ } .flex-container div.bg-alt{ background: #b4bac0; } </style> </head> <body> <div class="flex-container"> <div class="item1">Item 1</div> <div class="item2 bg-alt">Item 2</div> <div class="item3">Item 3</div> </div> <p><strong>Note:</strong> If you change the width of the flex-container the width of the flex items will automatically adjusted without doing anything.</p> </body> </html>