小编Lui*_*uiz的帖子

在图像尺寸上使用 rem、em 和 px

我正在寻找有关这些单位在图像尺寸上的使用的一些解释,但找不到任何解释。我在一些地方读到忘记像素并仅使用 rem/em,但我不知道它是否也适用于图像尺寸(宽度/高度)。

例如,在下面的这种情况下我应该使用哪一个?

<img src="https://i.imgur.com/NReN4xE.png" style="width: 5rem;" />5rem<br>
<img src="https://i.imgur.com/NReN4xE.png" style="width: 5em;" />5em<br>
<img src="https://i.imgur.com/NReN4xE.png" style="width: 100px;" />100px<br>
Run Code Online (Sandbox Code Playgroud)

html css

1
推荐指数
1
解决办法
2万
查看次数

标签 统计

css ×1

html ×1