Pages

Thursday, June 16, 2011

Cross-Browser CSS Horizontal Centering


/* use for inline (such as text or images) children */
.hcenter-child
{
text-align:center;
}
/*reset the text align, as it inherits*/
.hcenter-child *
{
text-align:left;
}

/* use for block children (ex divs) */
.hcenter
{
width:96%; /*needs any width other than auto*/
margin-left:auto;
margin-right:auto;
}

No comments:

Post a Comment