I am trying to get centered in a space that remains empty on the sidebar. Here's how I would like to look like this:

I really managed to make this work OK for most browsers using margin: auto for the div in question by setting overflow: hidden :
Here is the script
CSS
#header { height: 50px; background: #224444; color: #fff; } #container div { padding: 1em; } #content { max-width: 400px; margin: auto; background: #ddd; height: 300px; overflow: hidden; } #sidebar { float: right; width: 200px; background: #aaa; height: 300px; }
HTML
<div id="container"> <div id="header"> PAGE HEADER </div> <div id="sidebar"> Sidebar </div> <div id="content"> Centered Content (Works everywhere but on IE9) </div> </div>
However, it does not work with IE9. It is strange that IE8 is working fine!
I'm running out of ideas, so I thought maybe someone knows what is going on? The trick seems to work great everywhere.
NOTE Note that the content of the div should be flexible, as in the demo. As available space is reduced, it must resize and shrink.
source share