Align a DIV width to the center


You may face this css problem, that a div area of a specific width, of course not equal but less than page width, can not be aligned to the center of the page — even if you include it inside another div area with “text-aling:center” and align=”center” properties.

By default a div area regards the full width of a page, even if its contents occupy only a very small percentage of that width.

To bring the contents of a div area to the center of the page, just define it as inline-block.

The property you should add to its style is display:inline-block.