Zedric Myers

Center an Absolute Positioned Div

Est. Read Time: ~Keurig Brew-Time

Need to center an absolute div on a page?

This is a simple CSS snippet will auto center an absolute positioned div. There are a few ways, but this bar far is the more simple approach.

.contentBlock {

width: {define width}
position: absolute;
left: 0;
right: 0;
margin-left: auto;
margin-right: auto;