Forums

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
    Posts
  • #239763
    xiana
    Participant

    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: http://quincyseattle.com/index2.htm
    CodePen link: https://codepen.io/xiana/pen/aNwomz

    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.

    #239764
    Shikkediel
    Participant

    Why not use CSS calc()?

    .main {
    width: calc(100% - 300px);
    }
    
    #239767
    Paulie_D
    Moderator

    Flexbox…obviously

    https://codepen.io/Paulie-D/pen/BKZaOa

    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.