p:only-child
{
}
上面这个我懂了..
我想问某标签有多个p 标签怎么表示?
就是这个<p>的数量大于1
大家讲道理2017-04-17 14:01:50
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.
高洛峰2017-04-17 14:01:50
Just p p, select all p tags under p, you can also select the first, last, odd number, even number