The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Div Width w/ Margin Goes Beyond 100%

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #239763

    I feel like I’ve read a million similar posts about this today, but having tried a bunch of the recommended fixes, I’m still unable to solve this simple problem: I have 2 divs, one of which is a fixed-width sidebar, and the other which needs to take up the rest of the screen. I’ve tried to put them side by side, then overlapping (as in the code attached), but of course “100%” is the wrong width either way. “Auto” seems to just reduce it to 1 pixel width.

    Super-basic live site:
    CodePen link:

    What am I missing here? We’ve been having insanity-inducing domain issues all day so I think I broke my brain. Thanks in advance for any help.


    Why not use CSS calc()?

    .main {
    width: calc(100% - 300px);


    BTW..<center> is a deprecated element and should no longer be used.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘CSS’ is closed to new topics and replies.