.container { display: flex; justify-content: center; }.container{ margin: 0 auto; display: flex; align-items: center; }center{ display: block; margin-left: auto; margin-right: auto; width: 50%; }/* Assume the div has a class of "center" The below would center it horizontally */ .center { margin-left: auto; margin-right: auto; } /* There is a shorthand and it is given below */ .center { margin: 0 auto; }.parent { display : flex; justify-content : center; align-items : center; }//Center DIV HTML5 <body> <div style="width:800px; margin:0 auto;"> centered content </div> </body>.parent { justify-content : center; align-items : center; }#inner { display: table; margin: 0 auto; border: 1px solid black; } #outer { border: 1px solid red; width:100% }<center> <p>I'm center text only with Html</p> </center><div class="row ml-5 mr-5"> <div class="col-4 d-flex justify-content-start"> <div class="card ml-4" style="width: 18rem;"> <img src="..." class="card-img-top" alt="..."> <div class="card-body"> <h5 class="card-title">Card title</h5> <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p> <a href="#" class="btn btn-primary">Go somewhere</a> </div> </div> </div> <div class="col-4 d-flex justify-content-center "> <div class="card" style="width: 18rem;"> <img src="..." class="card-img-top" alt="..."> <div class="card-body"> <h5 class="card-title">Card title</h5> <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p> <a href="#" class="btn btn-primary">Go somewhere</a> </div> </div> </div> <div class="col-4 d-flex justify-content-end"> <div class="card" style="width: 18rem;"> <img src="..." class="card-img-top" alt="..."> <div class="card-body"> <h5 class="card-title">Card title</h5> <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p> <a href="#" class="btn btn-primary">Go somewhere</a> </div> </div> </div> </div><div class="d-flex justify-content-center">...</div>