Let's quickly review some of the basic syntax and anatomy of CSS code.
If we wanted to style all the div
s on a given page with a height
and width
of 400px
as well as a blue background, then our CSS code could be as follows:
div {
height: 400px;
width: 400px;
background: blue;
}
-
How should we look at components on the web?
-
What is the box model? how does it relate?
-
Component breakdown
- Margin
- Padding
- Border
- What is the float property?
- When do we need to use it?
The box-sizing property is used to tell the browser what the sizing properties (width and height) should include.
Should they include the border-box? Or just the content-box (which is the default value of the width and height properties)?
Since it's just another CSS property, we can use it as such.
It takes 1 of four possible values:
content-box
: Default. The width and height properties (and min/max properties) includes only the content. Border, padding, or margin are not includedborder-box
: The width and height properties (and min/max properties) includes content, padding and border, but not the margin.initial
inherit