[CSS3] :empty Selector When the element has empty content, you might want to display some text to idicate the compoent is loading... <!DOCTYPE html><html><head><style>p:empty{width:100px;height:20px;background:#ff0000;}p:empty:after{content:"Loading..., please wait"}</style></...
简单,你可以使用:empty选择器 <p></p><!-- NOT empty: note the blank space --><p></p><!-- YES empty: nothing inbetween --> p::before{font-family:"FontAwesome";content:"\f240";}p:empty::before{content:"\f244";}p{color:silver;}p:empty{color:red;} empty 是什么意思? 当我第...
ID 选择器(ID Selector):通过元素的唯一标识符(ID)选择 HTML 元素。 ID 选择器以#开头,后面跟着 ID 名称。 如下代码,#runoob选择器将选择具有 ID 为"runoob"的元素。 #runoob {width:200px;} 属性选择器(Attribute Selector):通过元素的属性选择 HTML 元素。属性选择器可以根据属性名和属性值进行选择。 如下...
3.2.2 E:empty匹配没有子元素的元素,且该元素五任何文本节点 <style>.item1:first-child{color:red;}.item1:nth-of-type(2){background:blue;}</style><divclass="ct"><pclass="item1">aa</p><h3class="item1">bb</h3><h3class="item1">ccc</h3><divclass="item1">ddd</div></div> 3.2...
通用兄弟选择器(General Sibling Selector) task13 html13 答案:bento~pickle 第十四关 子元素选择器(Child Selector) task14 html14 答案:plate>apple 第十五关 首子元素选择器(First Child Pseudo-selector) task15 html15 答案:plate orange:first-child ...
一、CSS3选择器分类 1.基本选择器 2.层次选择器 3.伪类选择器 1)动态伪类选择器 2)目标伪类选择器 3)语言伪类选择器 4)UI元素状态伪类选择器 5)结构伪类选择器 6)否定伪类选择器 4.伪元素 5.属性选择器 二、基本选择器语法 这里着重说一下群组选择器(selector1,selector2,…,selectorN),是将有相同...
:empty p:empty选择没有子元素的每个<p>元素(包括文本节点)。 :not(selector) :not(p)选择非<p>元素的每个元素。 input状态选择器 :focus获得焦点的 input 元素 :enabled每个启用的 input 元素 :disabled每个禁用的 input 元素 :checked每个被选中的 input 元素...
CSS :empty 选择器实例 指定空的 p 元素的背景色:<!DOCTYPE html> <html> <head> <style> p:empty { width: 100px; height: 20px; background: #ff0000; } </style> </head> <body> <p></p> <p>一个段落</p> <p>另一个段落</p> </body> </html>...
The:emptypseudo selector selects empty elements. We can use this to display useful messages instead of the empty content or hide the content completely. However, the:emptypseudo selector comes with a couple of potentially confusing behaviors when it comes to which elements it considers empty. ...
:emptyp:empty选择所有没有子元素的p元素 :enabledinput:enabled选择所有启用的表单元素 :first-of-typep:first-of-type选择的每个 p 元素是其父元素的第一个 p 元素 :in-rangeinput:in-range选择元素指定范围内的值 :invalidinput:invalid选择所有无效的元素 ...