Combinators in css:-
this define relationships between selectors.
A CSS selector can connect to more than one simple selector. Between the simple selectors, we can be the include a combinators.
There are four ways combinators in CSS:-
<style>
div p {
background-color: blue;
}
</style>
<div>
<p>Code family.</p>
<p>Code family.</p>
<section><p>Code family.</p></section>
</div>
<p>Code family</p>
<p>Code family</p>
<style>
div > p {
background-color: blue;
}
</style>
<div>
<p>Code family.</p>
<p>Code family.</p>
<section><p>Code family</p></section>
<!-- not Child but Descendant -->
<p>Code family</p>
</div>
<p>Code family.</p>
<p>Code family.</p>
<style>
div + p {
background-color: yellow;
}
</style>
<div>
<p>code family.</p>
<p>code family.</p>
</div>
<p>code family.</p>
<p>code family.</p>
<style>
div ~ p {
background-color: yellow;
}
</style>
<p>code family</p>
<div>
<p>code family</p>
</div>
<p>code family</p>
<code>code family</code>
<p>code family</p>