Saturday, 8 June 2013

CSS + Center align HTML element content using CSS

In case we need to center align HTML element content using CSS.
Using below ways we can do it.

1. If element contains text, then we can do it using text-align property
text-align:center;

2. If element contains child HTML elements inside it.
position:relative;
float:left;
left:50%;