Skip to content

Commit

Permalink
Improve an answer to the box model question (yangshun#110)
Browse files Browse the repository at this point in the history
* Improve an answer to the box model question

The question:
> What does `* { box-sizing: border-box; }` do? What are its advantages?
is actually 2 questions and in my opinion only the first one is answered. I tried to answer the second one, plus I used a reference post from Paul Irish.

* Update css-questions.md
  • Loading branch information
jdvivar authored and yangshun committed Apr 15, 2018
1 parent b5a8346 commit 01b98e5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions questions/css-questions.md
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,11 @@ The box model has the following rules:
* `box-sizing: border-box` changes how the `width` and `height` of elements are being calculated, `border` and `padding` are also being included in the calculation.
* The `height` of an element is now calculated by the content's `height` + vertical `padding` + vertical `border` width.
* The `width` of an element is now calculated by the content's `width` + horizontal `padding` + horizontal `border` width.
* Taking into account `padding`s and `border`s as part of our box model resonates better with how designers actually imagine content in grids.

###### References

* https://www.paulirish.com/2012/box-sizing-border-box-ftw/

[[] Back to top](#css-questions)

Expand Down

0 comments on commit 01b98e5

Please sign in to comment.