<span class="bold">Some Title</span>
.bold
{
font-weight:bold;
}
这呈现大胆,但是这样:
<strong>Some Title</strong>
没有。它只是呈现为常规文本。我使用的是 HTML5 文档类型和 Google 字体:
<link href='http://fonts.googleapis.com/css?family=Droid+Sans&v2' rel='stylesheet' type='text/css'>
有人遇到过这种情况吗?
编辑:BoltClock 建议它可能是 CSS 重置,这里是 <strong>
的 block
/** CSS Reset **/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
最佳答案
如果 strong
没有其他问题,那就是你的问题(或者更确切地说,CSS 重置的问题)。
font: inherit
样式以及所有这些选择器要求所有内容都从其父级继承每种字体样式。显然,默认权重是 normal
,因此 strong
文本在您重新声明之前不再是粗体:
strong { font-weight: bold; }
(要重置样式的其他一些明显元素是 b
、em
、i
、代码元素、引用元素、表格、标题、列表等)
关于css - 知道为什么 <strong> 标签不起作用但 CSS 起作用吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6813750/