Why are we using the "greater than" symbol in CSS when we implement properties of flex and grid? I've given a sample code below:
.flex-item > div {}
Help me, please.
Why are we using the "greater than" symbol in CSS when we implement properties of flex and grid? I've given a sample code below:
.flex-item > div {}
Help me, please.
This means 'every div that's a child of flex-item'
>
is used to select the element with a specific parent.
>
symbol isn't related to flex but it's part of CSS selector syntax. It is used to select immediate children. Here's an example:
<div class='first'>
<div class="second">
<div class="third">...</div>
</div>
<div class="second">
<div class="third">...</div>
</div>
...
</div>
Now
.first > div {
}
will only apply to the divs with second
class, since third
isn't immediate children of first
.