troubleshooting Question

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

Avatar of Brad Bansner
Brad Bansner asked on
CSS
2 Comments1 Solution1676 ViewsLast Modified:
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!
ASKER CERTIFIED SOLUTION
X-treem
ICT Manager

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros