1 posts in total


Posts tagged

Centering a Fixed-Sized Element with CSS

by Syed Aslam · 1 min read

Here is one way to center a fixed-width/fixed-height div at the center of its container. This could be adapted to centering text, images, etc. within their containers. Essentially, we do a bit of arithmetic to get the fixed-sized element centered using absolute positioning and ma ...