Centering An Inline-Block DIV

Posted by Aaron Brewer on Stack Overflow See other posts from Stack Overflow or by Aaron Brewer
Published on 2012-04-12T21:39:06Z Indexed on 2012/04/13 5:28 UTC
Read the original article Hit count: 160

Filed under:
|
|
|
|

Does anybody know how to center align a DIV that has the display set to inline-block?

I cannot set the display to block because I have a background image that needs to be repeated, and it needs to expand based on the content. It sits inside of a parent div, in which is larger when it comes to width.

So all in all. Does anyone have a fix to center align a div with the display set to inline-block?

And no, text-align: center; does not work, nor does margin: 0 auto;

jsFiddle: http://jsfiddle.net/HkvzM/

Thank you!

© Stack Overflow or respective owner

Related posts about html

Related posts about css