DEV Community

Discussion on: 3 Ways to CENTER a div in CSS

Collapse
 
unclecheap profile image
UncleCHEAP • Edited

Let's not forget yet a 4th way. No need for "positioning."

.parent {
    display: table-cell;
    text-align: center;
    vertical-align: middle;
}
.child {
    display: inline-block;
}
Enter fullscreen mode Exit fullscreen mode
Collapse
 
codeoz profile image
Code Oz

Didn't know it! Thanks you for sharing it!