Skip to content

Instantly share code, notes, and snippets.

@yuheiy
Last active February 5, 2026 13:30
Show Gist options
  • Select an option

  • Save yuheiy/f26c510976bf632a7362d4ff02952e63 to your computer and use it in GitHub Desktop.

Select an option

Save yuheiy/f26c510976bf632a7362d4ff02952e63 to your computer and use it in GitHub Desktop.
React Spectrumにおけるプロパティごとのrem単位とpx単位の使い分け

React Spectrumにおけるプロパティごとのrem単位とpx単位の使い分け

プロパティ 単位
border-spacing rem
flex-basis rem
gap rem
height rem
width rem
contain-intrinsic-width rem
contain-intrinsic-height rem
min-height rem
max-height rem
min-width rem
max-width rem
border-width px
stroke-width px
margin rem
padding px
scroll-margin rem
scroll-padding rem
text-indent rem
translate px
inset px
font-size rem
border-radius rem
media queries rem
  • キーワード値、単位無し値、パーセンテージは調査から除外
  • ロングハンドプロパティは省略
  • line-heightでは常に単位無し
  • チェックボックスのborder-widthはアイコンの一部と捉えてremを使用
  • 一部のプロパティではcalcを経由してrem/em/lhを使用
  • その他、一部の例外あり

参考

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment