Center an Absolute Positioned Div

Beacon Blog Article

By Zedric Myers | Published July 30, 2015 | Categories: Web Development

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;

}

Let's get to work!

Contact Us