【发布时间】:2021-01-07 04:01:07
【问题描述】:
我有以下基本页面,我想在其中设置 320 像素的媒体断点,但希望根字体大小为 14 像素,我已经设置了。为什么我的断点仍然设置为 16px x 22.8em = 364.8px 而不是 14px x 22.8em = 319.2px?如果我从 rem 更改为 em,我会得到相同的结果。
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>#</title>
<style type="text/css">
html {
font-size: 14px;
}
@media (min-width: 22.8rem) {
html {
font-size: 4rem;
}
}
</style>
</head>
<body>
<p>This is some text</p>
</body>
</html>
【问题讨论】:
-
我知道 em 用于包含元素,rem 用于根元素。
-
抱歉,我认为不应该根据字体大小移动断点。如果您的字体大小为 12 像素,那么您的计算机屏幕不会因此变小。断点=不同的设备宽度
标签: css