The box model
The browser draws every element as a rectangular box. Around the content are three layers:
+------------------- margin -------------------+
| +--------------- border ----------------+ |
| | +----------- padding -------------+ | |
| | | content | | |
| | +---------------------------------+ | |
| +---------------------------------------+ |
+----------------------------------------------+
- padding: space inside the border, between the border and the content.
- border: a line around the padding.
- margin: space outside the border, pushing other elements away.
.notice {
padding: 12px; /* all four sides */
border: 1px solid #cccccc; /* width, style, colour */
margin: 0 0 20px 0; /* top, right, bottom, left */
border-radius: 6px; /* rounded corners */
}
You can set one side at a time: padding-left, margin-top, border-bottom, and so on. Border styles include solid, dashed and dotted.
Your browser's developer tools (right-click, Inspect) show the box model of any element, which is the quickest way to understand spacing on real sites.
Your task
Style the .card class in style.css so each card has:
16pxof padding,- a
2px solid crimsonborder, 24pxof space below it (margin-bottom),- corners rounded by
8px.