promotion

Monday, November 21, 2011

How to align div in the center/Centre aligning a block element

Sometimes, you may have to align the <div> element (or) other block elements in center of the page. Centering a single element in a fixed area is easy. Just add "margin: 0 auto;" and a fixed width to the element you want to center, and the margins will force the element to center.
Here is how the CSS might look:
#content{ margin: 0 auto; width:400px; }

No comments:

Post a Comment