The child element selector does not work

  }
    .nav>li{
        list-style: none;
        float: left;
        width: 120px;
        line-height: 40px;
        background-color: green;
        margin-left: 10px;
        text-align: center;
    }
</style>

< / head >
< body >
< ul class= "nav" >

<li>
    <ul class="sub">
        <li></li>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
    </ul>

</li>
Css
Apr.17,2022

first of all, you need to understand what a sub-selector is, which selects direct child elements.
so the .nav > li written in your style refers to the direct child element li in .nav , and does not include the li element

in sub .

Update: emmmmmm, I don't understand what you are trying to say.

Menu