教你怎麼使用css3實現隔行換色

來源:互聯網
上載者:User
css3如何?隔行換色呢?使用css3選取器 p:nth-of-type(odd)奇數 和 p:nth-of-type(even)偶數

以下是部分執行個體:

<!DOCTYPE html><html><head><style> p:nth-of-type(odd){background:#ff0000;}p:nth-of-type(even){background:#0000ff;}</style></head><body> <h1>This is a heading</h1><p>The first paragraph.</p><p>The second paragraph.</p><p>The third paragraph.</p> </body></html>

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.