请问如何将同class的第一个元素选出来呢?<!DOCTYPE html><html><head><style> .test:nth-of-type(1){background:#ff0000;
}</style></head><body><h1>这是标题</h1><p>第一个段落。</p><p>第二个段落。</p><p class="test">第三个段落。</p><p>第四个段落。</p><p>第五个段落。</p><p class="test">第六个段落。</p><p>第七个段落。</p><p>第八个段落。</p><p>第九个段落。</p>.test:nth-of-type(1) 以及 nth-of-child(1)都不行呢?我想让第一个p.test 变红该怎么实现呢
1 回答
- 1 回答
- 0 关注
- 408 浏览
添加回答
举报
0/150
提交
取消