为什么要使用html,body{font-size:62.5%}?
使用以下代码查看浏览器的初始font-size:
<!DOCTYPE html> |
我在不同的浏览器,包括用谷歌浏览器模拟手持设备,得到的值都是16px;
html{font-size:62.5%;}表示设置浏览器文字大小初始值为10px,方便 'px' 转 'em' 或 'px' 转 'rem' 的单位换算。
2021-12-02 13:57:19
为什么要使用html,body{font-size:62.5%}?
使用以下代码查看浏览器的初始font-size:
<!DOCTYPE html> |
我在不同的浏览器,包括用谷歌浏览器模拟手持设备,得到的值都是16px;
html{font-size:62.5%;}表示设置浏览器文字大小初始值为10px,方便 'px' 转 'em' 或 'px' 转 'rem' 的单位换算。