欢迎来到DIVCSS5查找CSS资料与学习DIV CSS布局技术!

请注意标记为 <strong> 的蓝色代码的上下文关系:

<p><strong>我是粗体字,不是斜体字,因为我不在列表当中,所以这个规则对我不起作用</strong></p>

<ol>
<li><strong>我是斜体字。这是因为 strong 元素位于 li 元素内。</strong></li>
<li>我是正常的字体。</li>
</ol>

在上面的例子中,只有 li 元素中的 strong 元素的样式为斜体字,无需为 strong 元素定义特别的 class 或 id,代码更加简洁。

如需转载,请注明文章出处和来源网址:http://www.divcss5.com/shili/s53861.shtml