Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
html { font-size: 62.5%; } body { font-size: 1.4rem; } /* =14px */ h1 { font-size: 2.4rem; } /* =24px */
やあみんな、私は計算をしようとしています。body の 14px と h1 の 24px を取得するにはどうすればよいですか?
がhtmlパーセンテージでフォントサイズを指定されている場合、ユーザーがブラウザオプションで設定したフォントサイズ設定に基づいて計算されます。これは通常、ブラウザ全体の「標準」として16pxですが、もちろん、ユーザー自身の設定によって異なる場合があります。
html
16pxの62.5%は10pxでありhtml、絶対フォントサイズは10pxになります。そこから、とのサイズを簡単に計算できるはずbodyですh1。
body
h1