有没有办法从标题的一部分中去掉粗体样式?
<h1>**This text should be bold**, but this text should not</h1>
有没有一种方法可以达到这个目的?
有没有办法从标题的一部分中去掉粗体样式?
<h1>**This text should be bold**, but this text should not</h1>
有没有一种方法可以达到这个目的?
.notbold{
font-weight:normal
}
并且
<h1>**This text should be bold**, <span class='notbold'>but this text should not</span></h1>
参见:http://jsfiddle.net/MRcpa/1/
当您想要改变元素的样式而不将其放置在新的块级元素中时,请使用<span>
。
如果您不想使用单独的CSS文件,可以使用内联CSS:
<h1>This text should be bold, <span style="font-weight:normal">but this text should not</span></h1>
然而,正如Madara的评论所建议的那样,可能需要考虑根据所涉及的用例将未加粗部分放在不同的标题中。
是的,您可以在<span>
标签内添加文本并覆盖CSS样式。jsfiddle
HTML:
<h1>**This text should be bold**, <span>but this text should not</span><h1>
CSS:
span{
font-weight: normal;
}
<h1 style="font-weight: normal;"></h1>
试一下这个?
<div id="sc-nav-display">
<table class="sc-nav-table">
<tr>
<th class="nav-invent-head">Inventory</th>
<th class="nav-orders-head">Orders</th>
</tr>
</table>
</div>
在这里,您可以使用以下CSS:
#sc-nav-display th{
font-weight: normal;
}
你只需要使用分配给表格关联div标记的ID。 我在CSS中使用了“#sc-nav-display”和“th”,这样,除非你对所有其他表头都进行了相同的操作,否则每个其他表头都会保持粗体。
这非常简单,只需在段落内使用“font”即可。下面是一个示例:
<h1>Heading 1</h1>
<p><font size="6"> Heading 1</font></p>
标题 1
标题 1
<ul>
<li><strong>This text will be bold.</strong>This text will NOT be bold.
</li>
</ul>
strong
元素。 - Heretic Monkey