Complete Code For Aligning Div At The Center Of Container Using CSS.
<!DOCTYPE html> <html> <head> <title>How To Align Div At The Center Of Container Using CSS</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"/> </head> <style> body { background-color: #c68c53; } .flex-container { display: flex; justify-content: center; align-items: center; height: 300px; background-color: #996633; } .flex-container> div { background-color: #f1f1f1; color: black; padding: 20px; } </style> <body> <br/><br/> <div class="container"> <br> <div class="text-center"> <h1 id="color" style="color: white;">Align Div At The Center Of Container Using CSS</h1> </div> <br> <div class="well"> <div class="flex-container"> <div><h2>Hello am Div element and you made me to look prefect center</h2></div> </div> </div> </div> </body> </html>