請問如何將同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 回答
- 0 關注
- 427 瀏覽
添加回答
舉報
0/150
提交
取消