Let's say you have the following code snippet:
<div id="container"> <someelement>This is any element.</someelement> </div>
What better CSS could I use to horizontally center "someelement" inside its containing div?
<someelement> ( : inline), text-align: center . <someelement> - , auto ( , ). , , , IE 5.5 .
<someelement>
JaredPar , , ;)
#container { text-align: center; } #container someelement { margin: 0 auto; text-align: left; }
Try
<someelement style="margin-left:auto;margin-right:auto">This is any element</someelement>