element+element
In this chapter you will learn:
Description
The element1+element2
selector adds style for
element2
placed immediately after but not
inside the first specified element1
.
Example
<!DOCTYPE html><!-- j a v a 2s. c o m-->
<html>
<head>
<style>
div+p{
background-color:red;
}
</style>
</head>
<body>
<div>
<p>inside div.</p>
</div>
<p>after div.</p>
<p>not immediately after div.</p>
</body>
</html>
Next chapter...
What you will learn in the next chapter:
- Definition for Selector element1~element2
- An example showing how to use element1~element2 CSS selector
Home » HTML CSS Tutorial » CSS Selector Reference