Global border-box reset#3512
Merged
magento-team merged 1 commit intomagento:developfrom Apr 19, 2016
redrohX:patch-1
Merged
Conversation
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/
Contributor
|
@redrohX Thanks for contributing! I created internal ticket MAGETWO-50321 to process your PR. |
magento-team
pushed a commit
that referenced
this pull request
Apr 19, 2016
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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/