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

Home Forums CSS floats and widths and border boxes and stuff

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

    When I add margins to the “left” and “right” divs, they no longer float together on the same line. I thought that by making them “border-box”, the size would no longer be affected by margins. Can someone tell me what’s wrong here? Sorry, I’m a bit brain dead after going to the dentist and taking my pain meds, so I don’t feel like thinking too much. Here’s the code and thanks!

    [CodePen Example]( “CodePen Example”)


    Border-box does not include margins.

    > CSS3 Box-sizing
    > *Method of specifying whether or not an element’s borders and padding should be included in size units*


    Ah yes, that makes sense. I guess it’s better to use %’s for margin, so I can easily subtract them from the width %, rather than trying to figure out how 10px subtracts from 60%… Thanks!

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