Forum Bugs

Container padding calculated incorrectly when child elements have border (border-box)

ehzhang
Hello!

I ran into what I believe to be a bug when I add elements with borders to container elements with a specified padding. The child elements are set to have box-sizing: border-box, which should include the border in the calculated width.

However, while it appears that the padding-left is correctly calculated, there is extra padding on the right side that amounts to the correct padding + 2* the border width. (Seen in attached screenshots)

While I managed a workaround, this seemed like incorrect behavior and I thought it useful to bring to your attention.

Test case + Workaround
https://gist.github.com/ehzhang/fd6cf7948dd3be82675f518ba0cb0dcd

Thanks!
  1. Screen Shot 2017-04-25 at 9.11.58 AM.png59.1 kB
    Prince Render
  2. Screen Shot 2017-04-25 at 9.12.06 AM.png38.5 kB
    Expected Render
mikeday
Thanks, we will investigate this issue.
mikeday
It looks like shrink-to-fit layouts like inline-block and floating boxes are not taking into account the box-sizing property when calculating how big to make the container, which ends up bigger than necessary as a result.
mikeday
We have fixed this issue and the fix will be included in the next build in two weeks time.
ehzhang
Thanks for investigating and being so quick to fix! :D
mikeday
The latest build includes the fix for this issue.