CSS selecting all elements that are placed immediately after an element with a different attribute value

前端 未结 2 814
说谎
说谎 2021-01-26 17:01

HTML:

  • Test
  • Test
  • Test
2条回答
  •  一生所求
    2021-01-26 17:59

    I think this can be accomplished by using the nth-child() Selector:

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

    http://jsfiddle.net/davekerr/94Cgt/

提交回复
热议问题