派生选择器

li strong {
    font-style: italic;
    font-weight: normal;
  }

  ol li {
    font-style: inherit;
    font-weight: normal;
  }
<p><strong>我是粗体字,不是斜体字,因为我不在列表当中,所以这个规则对我不起作用</strong></p>

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

<ul>
    <li>xxx</li>
    <li>yyy</li>
</ul>

<ol>
    <li>111</li>
    <li>222</li>
</ol>

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

  1. 我是斜体字。这是因为 strong 元素位于 li 元素内。
  2. 我是正常的字体。
  • xxx
  • yyy
  1. 111
  2. 222
posted @ 2017-10-18 14:22  sky20080101  阅读(66)  评论(0)    收藏  举报