Which part of the CSS box model defines the space between the content and the border?
Think about the area that adds space inside the box but outside the content.
Padding is the space between the content and the border in the CSS box model. Margin is outside the border, border surrounds the padding, and content is the innermost area.
When two vertical boxes have adjacent margins, what happens to the space between them?
Consider how CSS handles vertical spacing between block elements.
In CSS, vertical adjacent margins collapse, meaning only the larger margin is used, not the sum of both.
A box has a content width of 200px, padding of 10px on all sides, border of 5px on all sides, and margin of 20px on all sides. What is the total width occupied by the box including margin?
Add content width, padding, border, and margin widths carefully.
Total width = content width + 2 * padding + 2 * border + 2 * margin = 200 + 20 + 10 + 40 = 270px
Note: The margin is included in the total space the box occupies.
How does setting box-sizing: border-box; affect the calculation of an element's width?
Think about how the total width changes when this property is applied.
With box-sizing: border-box;, the specified width includes content, padding, and border. This means padding and border do not add extra width outside the set width.
In a flex container with flex-direction: row; and three child boxes, if the first box has flex-grow: 1; and the others have flex-grow: 0;, what will happen when the container width increases?
Consider how flex-grow controls space distribution.
The flex-grow property defines how much a flex item will grow relative to others. Only the first box with flex-grow: 1; will expand to fill available space, others stay the same size.