Link to home
Start Free TrialLog in
Avatar of Brad Bansner
Brad Bansner

asked on

CSS for large DIV inside smaller DIV (overflow:hidden), possible to center large DIV?

I have a 100% x 500px DIV, overflow:hidden, position:relative.

Inside it is a 2000px x 500px DIV that I am going to shift around with Javascript, position:absolute.

Since the container DIV fills the entire screen left-to-right, I don't know what its width will be. I would like to center the interior DIV, but I can't because I don't know how many pixels to offset to make it centered.

Can this be done with a simple CSS setting? Or do I have to do something more involved, like with jQuery, to calculate its position and adjust dynamically?

Thank you!
Avatar of X-treem
Flag of Belgium image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Brad Bansner
Brad Bansner


Ah, awesome! Thank you!