Hey guys I am beginner at HTML and CSS and just faced the confusion when I try to choose the class being inside another class. That is, as you cann see in the code below I am trying to target .num1 class which is inside container class. The problem is why when I target .num1 directly nothing happens but when I target .container .num1{} all works as expected. Can't I just target num1 directly?
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
.container{
background: lightcoral;
display: flex;
justify-content: center;
align-items: stretch;
}
.container>div{
background: red;
border:3px solid black;
width: 150px;
height: 150px;
}
.num1{
height: 300px;
}
</style>
</head>
<body>
<div class="container">
<div class="item num1">1</div>
<div class="item">2</div>
<div class="item">3</div>
<div class="item">4</div>
<div class="item">5</div>
<div class="item">6</div>
</div>
</body>
</html>