Learning Flexbox from W3schools. I don’t understand this syntax here
.flex-container > div .What does the greater than sign mean here? I thought you can group multiple selectors with a comma?
<!DOCTYPE html>
<html>
<head>
<style>
.flex-container {
display: flex;
background-color: DodgerBlue;
}
.flex-container > div {
background-color: #f1f1f1;
margin: 10px;
padding: 20px;
font-size: 30px;
}
</style>
</head>
<body>
<h1>Create a Flex Container</h1>
<div class="flex-container">
<div>1</div>
<div>2</div>
<div>3</div>
</div>
<p>A Flexible Layout must have a parent element with the <em>display</em> property set to <em>flex</em>.</p>
<p>Direct child elements(s) of the flexible container automatically becomes flexible items.</p>
</body>
</html>
I suggest you find yourself a good CSS reference online so you can quickly lookup the answers to these types of questions. I don’t endorse any in particular but here’s one that came up near the top of my google search.
The greater than symbol applies the rules to all the direct children of the element.
.parent > .child { /* styles here */ }
<div class='parent'> <!-- does not apply to this -->
<div class='child'></div> <!--applies to this -->
<div class='child'> <!-- and this -->
<div class='child-child'></div> <!-- does not apply to this -->
</div>
</div>