Global
Confirmed 113,544,308 +10,890 new today Deaths 2,519,255 +911 new today Recovered 89,128,998 Active: 21,896,055 Last updated: February 26, 2021 - 9:04 am (+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