Reputation: 63667
I want a <div>
to be the size of its child element, but I also want to center it within a containing <div>
. How can I do this?
In that jsfiddle I try do display: inline-block
and margin: auto
but they don't work together.
Upvotes: 0
Views: 38
Reputation: 9172
You can use text-align: center
: http://jsfiddle.net/xjCGM/2/ (and you'll most likely use text-align: left
on the element itself)
Upvotes: 1