<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <style type="text/css"> #a{ width: 800px; height: 200px; background-color: ghostwhite; display: flex; /*flex-direction: column;*/ justify-content: center; align-items: center; } .b{ width: 100px; height: 50px; background-color: blue; text-align: center; line-height: 50px; border: 1px solid ghostwhite; font-size: 20px; font-weight: bold; } </style> </head> <body> <div id="a"> <div class="b"> 1 </div> <div class="b"> 2 </div> <div class="b"> 3 </div> </div> </body> </html>