Skip to content

Global border-box reset#3512

Merged
magento-team merged 1 commit intomagento:developfrom
redrohX:patch-1
Apr 19, 2016
Merged

Global border-box reset#3512
magento-team merged 1 commit intomagento:developfrom
redrohX:patch-1

Conversation

@redrohX
Copy link
Copy Markdown
Contributor

@redrohX redrohX commented Feb 23, 2016

When you set the width of an element, that's the width that it is. If you set the width to 25%, it will take up 1/4 of the horizontal space available in its parent element. That's not always the case.

With the default box-sizing, as soon as an element has either padding or border applied, the actual rendered width is wider than the width you set. Actual width = width + border-left + border-right + padding-left + padding-right.

With box-sizing: border-box the padding and border press their way inside the box rather than expand the box. The result is a box the exact width you set it to be and can count on.

More info: https://css-tricks.com/inheriting-box-sizing-probably-slightly-better-best-practice/ and http://www.paulirish.com/2012/box-sizing-border-box-ftw/

When you set the width of an element, that's the width that it is. If you set the width to 25%, it will take up 1/4 of the horizontal space available in its parent element. That's not always the case. 

With the default box-sizing, as soon as an element has either padding or border applied, the actual rendered width is wider than the width you set. Actual width = width + border-left + border-right + padding-left + padding-right. 

With box-sizing: border-box the padding and border press their way inside the box rather than expand the box. The result is a box the exact width you set it to be and can count on. 

More info: https://css-tricks.com/inheriting-box-sizing-probably-slightly-better-best-practice/ and http://www.paulirish.com/2012/box-sizing-border-box-ftw/
@MomotenkoNatalia
Copy link
Copy Markdown
Contributor

@redrohX Thanks for contributing! I created internal ticket MAGETWO-50321 to process your PR.

@magento-team magento-team merged commit 19bdc61 into magento:develop Apr 19, 2016
magento-engcom-team pushed a commit that referenced this pull request Dec 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants