CSS immediately after Selector element+element

Description

The element1+element2 selector adds style for element2 placed immediately after but not inside the first specified element1.

Example


<!DOCTYPE html>
<html>
<head>
<style>
div+p{<!--   ww w .j  ava 2 s . c  o  m-->
   background-color:red;
}
</style>
</head>
<body>

    <div>
        <p>inside div.</p>
    </div>

     <p>after div.</p>
     <p>not immediately after div.</p>

</body>
</html>

Click to view the demo

The code above generates the following result.

element+element




















Home »
  HTML CSS »
    HTML CSS Reference »




HTML Tag Reference
CSS Reference
CSS Selector Reference
Encoding Reference