Before someone down votes me for asking yet another centering problem. Please read my situation before judging!
I'm familiar with most common techniques for centering stuff but here is my situation. I have a DIV that must be both vertically and horizontally centered within its parent but it must also be fluid and not exceed the width of 890px.
Max-width achieves the fluid-ness that I want but because absolute positioned elements need width rather than max-width my vertical/horizontal centering breaks. At the moment i'm having to sacrifice fluid-ness over centering (or vice-versa) but I NEED both.
I'd like to keep the content within my centered DIV in view at all times, my current code doesn't do this, it hides the content as the window is made smaller http://jsfiddle.net/cCQ2w/
Can anyone propose a solution that might work for me?
I've tried to solve your problem. See this page: http://jsfiddle.net/PGce2/. So it centered horizontally and vertically and it is "fluid" and not exceed the width of 890px.
You can provide a width of 100% with max-width set to 890px.
I have shown [here][1] the sample of a div with both horizontally and vertically align center.
[1]: http://jsfiddle.net/r2qL5sgj/1/
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