jQuery Selector How to - Style div after certain div








Question

We would like to know how to style div after certain div.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
div {<!--   ww  w  .j  a  va 2 s  .  c  o m-->
  width: 200px;
  height: 100px;
  border: 1px solid black
}

div.reset_from_here_on ~ div {
  border: 1px solid red
}
</style>
</head>
<body>
  <div></div>
  <div class="reset_from_here_on"></div>
  <div></div>
  <div></div>
  <div></div>
</body>
</html>

The code above is rendered as follows: