1. Why Change The Box Model? +1px or +2px for Border Thickness


#1

LINK: https://www.codecademy.com/en/courses/learn-html-css/lessons/new-box-model/exercises/why-change-model

Not an error I am getting; more of a clarification needed please,

h1 {
  border: 1px solid black;
  height: 200px;
  width: 300px;
  padding: 10px;
}

This paragraph:
The 10 pixels of padding increases the height of the box to 220 pixels the width to 320 pixels. Next, the 1 pixel thick border increases the height to 221 pixels and the width to 321 pixels.

My query;
If you have a border thickness of 1px, would that not add 2px to the height (1px for the top & 1px for the bottom) instead of just the 1px as shown in the above paragraph? Thus making the height 222px.
If I am misunderstanding how the border thickness works, please could you explain?


#2

you got it right, the exercise got it wrong.


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.