结构性伪类选择器 :root :not() :empty

2016-09-27  本文已影响9人  Simon_s

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
/root 设置页面根元素的样式/
:root{
background-color: brown;
}
p{
height: 30px;
background-color: blue;
}
/not 排除某个或某类元素/
/* not (被排除的元素的选择器)/
p:not(.iten3){
background-color: blueviolet;
}
/
指定的前面选择器所选的元素为空的 添加相应的样式*/
div:empty{
height: 100px;
background-color: cyan;
}
</style>
</head>
<body>
<p class="iten1"></p>
<p class="iten2"></p>
<p class="iten3"></p>
<p class="iten4"></p>
<p class="iten5"></p>
<div></div>
</body>
</html>

上一篇下一篇

猜你喜欢

热点阅读