how to center divs code example
Example 1: div align center
.center {
text-align: center;
}
// or
<div style="text-align:center">
</div>
Example 2: how to center a div element
/*ADD MARGIN auto to left and right*/
.box1{
width:80%;
margin:0 auto;
}
Example 3: how to center a div
.container {
...
display: flex;
justify-content: center;
}
Example 4: how to center a div
margin:auto
Example 5: how to center a div
<div class="container">
<div class="child"></div>
</div>