Box Model¶
- content
- Padding
- inner space
- same background as content
- [[Border]]
- [[Margin]]
padding/margin: 50%¶
https://courses.joshwcomeau.com/css-for-js/01-rendering-logic-1/05-padding
relative to the width width
Units for border/margin/padding¶
text
use rem
- don't use
em
- we want text to start-align
border/margin/padding: use pixels
- we want more words per page
Ways to affect zooming 1. cmd +/- 1. increases the size of a pixel 2. browser/OS font size 1. only increases text size
Percents¶
- percent is based on the width
- possibly sometimes the height?
- margin-top: 10% may be calculated from the parent width, not height?
Logical properties¶
Prefix with
border
margin
-
padding
-
-block-start: top
- -block-end: bottom
- -inline-start:left
- -inline-end: right
example
border-block-start: 10px
box-sizing
¶
Default: box-sizing: content-box
width: 100px
- content: 100px
box-sizing: border-box
- setting
width: 100px
- content + padding + border = 100px
Last update:
2023-02-03