html - <p> 标签不接受 CSS 类或 ID

标签 html css

HTML

<p style="font-size:24px;">Inline Test</p>
<p class="1head">TEST</p>
<p class="1body">TEST</p>

CSS

@font-face {
    font-family: SegoeUI;
    src: url(segoeui.ttf); /* Yes, it is licensed */
}
body {
    padding: 0px;
    font-family: SegoeUi;
    margin: 0px;
    font-weight: 400;
}
.1head {
    font-size: 24px;
    color: #2C3E50;
    padding-bottom: 10px;
}
.1body {
    font-size: 16px;
    color: #2C3E50;
}

p 元素似乎不接受类或 ID。

当我使用网络浏览器工具查看 CSS 是否正常通过时,它根本没有出现。其他 CSS 元素(例如 div 等)接受来自同一样式表的 CSS。如何解决这个问题?

最佳答案

参见 W3C 的 Syntax and basic data types, 4.1.3 Characters and case :

In CSS, identifiers (including element names, classes, and IDs in selectors) can contain only the characters [a-z0-9] and ISO 10646 characters U+00A1 and higher, plus the hyphen (-) and the underscore (_); they cannot start with a digit, or a hyphen followed by a digit. Identifiers can also contain escaped characters and any ISO 10646 character as a numeric code (see next item). For instance, the identifier "B&W?" may be written as "B&W?" or "B\26 W\3F".

关于html - <p> 标签不接受 CSS 类或 ID,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21438080/

相关文章:

javascript - JavaScript 中的按钮点击计数器

php - 用 “CSS” 创建 “PHP”

javascript - 半圆弧滚动javascript

html - 样式图片元素

python - 如何在 css 中为 flask 应用程序链接英雄形象

html - 即使选中复选框也不会提交

css - wikia css 的背景问题

CSS Div 重叠,如何强制一个在另一个之上?

css - 为什么没有尺寸css属性?

php - 以编程方式分析 CSS 布局