What does the + (plus sign) CSS selector mean?

Experience Level: Junior
Tags: CSS

Answer

The + (plus sign) CSS selector is used to select the elements that are placed immediately after the specified element but not inside the particular elements.

Example
<html>
  <body>
    <style>
      ul {
        display: none;
      }

      a:hover + ul {
        color: red;
        display: block;
      }
    </style>

    <a>Put mouse here</a>
    <ul>
      <li>This will be shown</li>
    </ul>
  </body>
</html>

Comments

No Comments Yet.
Be the first to tell us what you think.