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/