font-size:30; 会是什么?相当于px?

What would font-size:30; be equivalent to in px?

font-size:30;

我知道有: empxptpercent

只有数字旁边没有任何内容是什么意思?

该测量值有名称吗?

此外,font-size:30; 等同于 px 中的什么?

这些是 none。无单位 font-size 声明无效,将被浏览器忽略:

<div style="font-size: 14;">14</div>
<div style="font-size: 20;">20</div>
<div style="font-size: 26;">26</div>

<div style="font-size: 14px;">14px</div>
<div style="font-size: 20px;">20px</div>
<div style="font-size: 26px;">26px</div>

如果您在开发人员工具中查看此元素,您会发现它被视为无效而被忽略:

如果只写font-size:30;不会影响您的网站

Do you need like this,

<div style="font-size: 10;">10</div>
<div style="font-size: 20;">20</div>
<div style="font-size: 30;">30</div>

<div style="font-size: 10px;">10px</div>
<div style="font-size: 20px;">20px</div>
<div style="font-size: 30px;">30px</div>

您可以在 link 中看到变化:https://jsfiddle.net/17d80ym3/18/

CSS 支持多种度量单位,包括绝对单位,如英寸、厘米、点、像素等,以及相对单位,如百分比和 em 单位。在样式规则中指定各种测量值时需要这些值,例如 border = "1px。有时它取决于您的浏览器。浏览器对 css 的单位测量值的默认配置是什么。但我认为在 Google- Chrome 像素是为 css 及更高版本指定的默认单位。 所以,是的 font-size:30; 等同于 px.

中的 30px

它将无效。

这里有一个提示。使用浏览器的开发人员工具在您当前创建的网站上进行测试。

例如:Google Chrome: 转到设置选项卡 > 更多工具 > 开发人员工具或 Ctrl+Shift+I 开发人员工具将帮助您作为解决方法的指南。

DevTools 为 Web 开发人员提供深入访问浏览器及其 Web 应用程序内部的途径。