CSS3 结构性伪类选择器—empty
:empty选择器表示的就是空。用来选择没有任何内容的元素,这里没有内容指的是一点内容都没有,哪怕是一个空格。
例如:给下面div里内容为空的加上边框
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>结构性伪类选择器—empty</title>
<style>
div{
width:250px;
height:20px;
}
div:empty{
border:1px solid orange;
}
</style>
</head>
<body>
<div>我这里有内容</div>
<div> <!-- 我这里有一个空格 --></div>
<div></div><!-- 我这里任何内容都没有 -->
</body>
</html> Dcr163的博客
http://dcr163.cn/120.html(转载时请注明本文出处及文章链接)
