“Sel empty”的版本间差异
本页内容
(创建页面,内容为“{{DISPLAYTITLE::empty}}3 = CSS3 :empty 选择器 = 完整CSS选择器参考手册 指定空的p元素的背景色: <sample title="" desc="" lang="html" hererun="1"> p:empty { background:#ff0000; } </sample> <run name=""> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>小白教程(xiaobai.wang)</title> <style> p:empty { width:100px; height:20px; background:#ff0000; } </style> </…”) |
无编辑摘要 |
||
第44行: | 第44行: | ||
{| class="table table-striped table-hover" | {| class="table table-striped table-hover" | ||
! 选择器 | ! 选择器 | ||
! | ! Chrome | ||
! | ! Internet Explorer / Edge | ||
! | ! Firefox | ||
! | ! Safari | ||
! | ! Opera | ||
|- | |- | ||
| :empty | | :empty |
2022年8月19日 (五) 04:33的版本
CSS3 :empty 选择器
指定空的p元素的背景色:
示例
p:empty
{
background:#ff0000;
}
定义和用法
- empty选择器选择每个没有任何子级的元素(包括文本节点)。
浏览器支持
表格中的数字表示支持该属性的第一个浏览器版本号。
选择器 | Chrome | Internet Explorer / Edge | Firefox | Safari | Opera |
---|---|---|---|---|---|
:empty | 4.0 | 9.0 | 3.5 | 3.2 | 9.6 |