Global
Confirmed 162,663,552 +130,774 new today Deaths 3,374,574 +3,472 new today Recovered 141,667,882 Active: 17,621,096 Last updated: May 15, 2021 - 7:52 pm (+05:30)
Home Coding Center the div horizontally in css

Center the div horizontally in css

by Admin

 

HTML Text

          
 <!-- !Note: YouTube Video start -->
    <div class="centerDiv">
      <h1>Hello</h1>
    </div>
 <!-- !Note: YouTube Video End-->
        

CSS Text

.centerDiv{
     display:flex;
     align-items:center;
     justify-content:center;
     background:red;
     color:#fff;
     }

Related Articles

Leave a Comment

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Decline