Show Output
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <title>Center a Content in Bootstrap 4</title> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css"> <script src="https://code.jquery.com/jquery-3.5.1.min.js"></script> <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js"></script> <style> /* Some custom styles to beautify this example */ .row { background: #dbdfe5; } .demo-content { padding: 25px; font-size: 18px; background: #abb1b8; } </style> </head> <body> <div class="container"> <div class="row justify-content-center"> <div class="col-sm-6"> <div class="demo-content">.col-sm-6</div> </div> </div> </div> </body> </html>