Showing posts with the label CSS center div on page

How to center a div - 2 Easiest and Effective way Explained

  How to center a div ? Its one of most asked question from a webdev newbie or a beginner that how can be center a div (<div>). So Today in this article i am going to tell you 2 most easiest and effective ways to center a div. Let's begin with our first method : 1st Method To Center a div  (<div>) : In our first method we will use little bit css (flex box), I had written code below - .your-div-class { display:flex; justify-content:center; align-items:center; } This is most used and advanced way to center a div with this technique you will find much ease while making a responsive website or a webpage. 2nd Method To Center a Div (<div>) : It is most easiest and effective ways or method to center a div it never fails. after implementing this technique its impossible that you will get results. See code below - <div class="your-class" align="center"></div> Explanation Now its time to explain guys and its my favorite moment because i love