1. CSS ordinary sibling selectors refer to all elements connected to another element, both of which have the same parent element.
2. The ordinary brother selector uses the tilde (~) as the combining symbol for ordinary brothers.
Example
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Common sibling selector</title>
<style>
.ancestor {
width: 500px;
height: 300px;
}
.parent {
width: 300px;
height: 200px;
}
.child {
width: 200px;
height: 100px;
}
/* Position the element whose sibling is div after .child1*/
.child1~div {
background-color: lightcoral;
}
</style>
</head>
<body>
<div>
this is ancestor.
<div>
this is parent.
<div>this is child0.</div>
<div>this is child1.</div>
<div>this is child2.</div>
<div>this is child3.</div>
</div>
</div>
</body>
</html>
The above is the understanding of css ordinary sibling selector, I hope it will be helpful to everyone.
More css learning guide: css tutorial