html - css选择器,不唯一怎么表示?
PHP中文网
PHP中文网 2017-04-17 13:59:50
0
2
966
p:only-child
{
}

上面这个我懂了..

我想问某标签有多个p 标签怎么表示?
就是这个<p>的数量大于1

PHP中文网
PHP中文网

认证高级PHP讲师

reply all(2)
大家讲道理
p:first-child:nth-last-child(n+2),
p:first-child:nth-last-child(n+2) ~ p

I guess this is what the questioner wants. When the number of p elements is greater than or equal to 2, all p elements are selected; when the number of p elements is less than 2, none of the p elements are selected.
In fact, this method can be generalized to select all elements when the number of elements is within a certain number or range.
For details, please refer to Chapter 38 of "CSS Revealed": Setting styles based on the number of sibling elements.

小葫芦

Just p p, select all p tags under p, you can also select the first, last, odd number, even number

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template