其他分享
首页 > 其他分享> > CSS兄弟选择器

CSS兄弟选择器

作者:互联网

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>

/*毗邻兄弟选择器(向下)*/
.c1 + .c2{
color: blue;
}

/*普通兄弟选择器(向下)*/
.c1 ~ .c4{
color: yellow;
}

.c5 ~ .item{
color: red;
}
</style>
</head>
<body>


<div class="item c1">i1</div>
<div class="item c2">i2</div>
<div class="item c3">i3</div>
<div class="item c4">i4</div>
<div class="item c5">i5</div>
<div class="item c6">i6</div>
<div class="item c7">i7</div>

</body>
</html>

 

标签:blue,color,选择器,兄弟,c1,向下,CSS
来源: https://www.cnblogs.com/A121/p/16295779.html