CSS3: only-child selector
CSS selectors complete reference manual
Examples
P matching elements belonging to the parent element only child element:
p:only-child
{
background:#ff0000;
}
{
background:#ff0000;
}
try it"
Definition and Usage
: Only-child selector matches the element belonging to the parent element only child element.
Browser Support
Figures in the table represent the first browser to support the version number of the property.
选择器 | |||||
---|---|---|---|---|---|
:only-child | 4.0 | 9.0 | 3.5 | 3.2 | 9.6 |