찾다

 >  Q&A  >  본문

css3 - 关于nth:child(2)的问题

<style> 
:nth-child(2)
{
background:#ff0000;
}
</style>
<body>

<p>第二个段落。</p>
<p>第三个段落。</p>
<p>第四个段落。</p>
<p>第五个段落。</p>

</body>

为什么全屏都会变成红色,不是应该只有第二个p的背景颜色才变红吗

ringa_leeringa_lee2866일 전699

모든 응답(1)나는 대답할 것이다

  • 伊谢尔伦

    伊谢尔伦2017-04-17 12:01:08

    你落下 p

    p:nth-child(2)
    {
    background:#ff0000;
    }

    회신하다
    0
  • 취소회신하다