Skip to content

Commit

Permalink
doc: update article (CSS Units - px、%、em、rem)
Browse files Browse the repository at this point in the history
  • Loading branch information
JennieSH committed Aug 8, 2023
1 parent aaf1577 commit 987f35e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion contents/dev/CSS/css-units.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ html {

大多數瀏覽器 `1rem``1em` 都等於 `16px` (root element),但因為 em 會自動繼承其父元素字體大小,如果 DOM 層級過深,很容易會發生預期以外的效果,所以通常網頁開發會優先選擇 `rem`,來保持一致性和可預測性,如 [tailwindcss](https://tailwindcss.com/docs/width)`rem` 來制定寬度標準。

除非是在需要只考慮附近父元素字體大小,才會選擇 `em`,總歸一句,就是要先確定設計需求,再進一步選擇需要的單位。
除非是在需要只考慮附近父元素字體大小,才會選擇 `em`否則一率優先考慮 `rem`總歸一句,先釐清設計需求,再進一步選擇需要的單位。

### em

Expand Down

0 comments on commit 987f35e

Please sign in to comment.