Let's say you have the following chunk of code:
<div id="container">
<someelement>This is any element.</someelement>
</div>
What's the best CSS I could use to horizontally center "someelement" within its containing div?
JaredPar has the right idea, but here's a cleaner way to do what you're looking for ;)
#container {
text-align: center;
}
#container someelement {
margin: 0 auto;
text-align: left;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With