0

I will want to understand how to use the symbol ~ in CSS?

In this example below, why Spain and Italy are in yellow color?

enter image description here

Thank you very much.

div ~ p {
  background-color: yellow;
}
<div class="container">
   <p>Belgium</p>
   <div>
      <p>French</p>
   </div>
   <p>Spain</p>
   <p>Italy</p>
</div>
poporp
  • 71
  • 5
  • 1
    You may have to read more about selectors in css ... – KcH Sep 05 '22 at 13:52
  • Hi. The tilde selector select all elements after. So here it will select all the p after the div (at the same level). https://www.w3docs.com/snippets/css/what-does-the-css-tilde-selector-mean.html – Ken La Sep 05 '22 at 14:22

0 Answers0