黄子涵

查漏补缺——说说rem和em的区别

问题

如题所示

答案

rem和em的区别

em,rem的区别与使用

相关的源码如下:

.hzh-back-top {
  background-color: #ffffff;
  position: fixed;
  right: 3rem;
  bottom: 8rem;
}

rem是根据html根目录下的字体大小来计算的。em是根据父元素的字体大小来计算的。

posted @ 2022-06-26 11:04  黄子涵  阅读(127)  评论(0编辑  收藏  举报