Run ยป
<!DOCTYPE html> <html> <head> <title>Title of the document</title> <style> body{ margin: 10px; font-size: 15px; } .container-1{ width: 750px; float: left; height: 400px; background-color: #25354c; text-align: center; } .container-1 .center{ width: 200px; height: 200px; background-color: #ad4343; display: inline-block; font-size: 16px; color: white; } </style> </head> <body> <h2>1. Center div tag with text-align: center css</h2> <div class="container-1"> <div class="center"> Center box with text-align: center </div> </div> </body> </html>