Simple question :D
How can I center an inline div (not its content) using css?
VERY IMPORTANT: the width of the div is unknown (I can not specify it)
Simple question :D
How can I center an inline div (not its content) using css?
VERY IMPORTANT: the width of the div is unknown (I can not specify it)
If by inline you mean, its CSS display property is set to inline
then you can center it by giving the immediate parent container a text-align:center
If you mean a div within another div, you can follow this approach if you can add a wrapper and float both:
Wrap it into a div that you can specify the width of and then set the margins of the div in question to: margin: 0, auto;
you can probably get away with display:inline-block
and text-align:center;
on the parent element if you want it it to be "blocky". also you'll probably need to give it a vertical-align:top