I’m having a problem similar to Adding overflow-y to block element causes width to decrease., but I want my right div to be centered horizontally. So I have “margin: auto;” on the right div.
This worked fine until I added “overflow-y: auto” (or scroll) to the right div. Before this, the margins were measured from the entire page width. After adding it, it measures from the right edge of the left div, so instead of being centered on the page, it’s centered on the remaining portion of the page.
Simple demo of the problem at:
You can add position:absolute; to the sidebar to achieve the same effect with the second example.