目前还不理解它们的应用场景,暂时倾向于使用 em,rem 少用 px 。
一种观点:
- Pixels are ignorant, don't use them.
- Use REMs for sizes and spacing.
- Use EMs for media queries.
——来自阅读材料 1
一些阅读材料:
- https://engageinteractive.co.uk/blog/em-vs-rem-vs-px
- https://stackoverflow.com/q/11799236/12539782
- https://zellwk.com/blog/media-query-units/
- Numbers, lengths, and percentages - MDN
- REM vs EM – The Great Debate
- https://web.dev/learn/css/sizing/
- What does 100% mean in CSS?
- https://www.w3.org/TR/css-values-4/#px