単位 em と rem
よく忘れるのでメモ。
どちらもfont-sizeを表す。
単位 | 説明 |
---|---|
1 em | 要素のfont-size |
1 rem | root要素のfont-size |
要素の font-size
が 10pxのとき
単位 | サイズ[px] |
---|---|
1 em | 10px |
2 em | 20px |
3 em | 30px |
参照
ルート要素 (= html要素)
よく忘れるのでメモ。
どちらもfont-sizeを表す。
単位 | 説明 |
---|---|
1 em | 要素のfont-size |
1 rem | root要素のfont-size |
要素の font-size
が 10pxのとき
単位 | サイズ[px] |
---|---|
1 em | 10px |
2 em | 20px |
3 em | 30px |
ルート要素 (= html要素)