为什么我的下拉菜单是横向的,而不是下拉的?

Why is my dropdown going sideways, instead of drop down?

我是 css 的新手。我尝试按照教程进行操作并稍作更改即可实现。我尝试使用列表添加下拉菜单。但菜单没有向下,而是横向移动。请帮忙!

我是 css 的新手。我尝试按照教程进行操作并稍作更改即可实现。我尝试使用列表添加下拉菜单。但菜单没有向下,而是横向移动。请帮忙!

我想要一个可折叠的菜单。

如果你能推荐一些好的学习资源,我会很有帮助css

*{
    padding: 0;
    margin: 0;
    text-decoration: none;
    list-style: none;
    box-sizing: border-box;
  }
  body{
    font-family: montserrat;
    background-image:url("background.png")
    
  }
  nav{
    background: #179942;
    height: 80px;
    width: 100%;
  }
  label.logo{
    color: white;
    font-size: 35px;
    line-height: 80px;
    padding: 0 100px;
    font-weight: bold;
  }
  nav ul{
    float: right;
    margin-right: 20px;
  }
  nav ul li{
    display: inline-block;
    line-height: 80px;
    margin: 0 5px;
  }
  nav ul li a{
    color: white;
    font-size: 17px;
    padding: 7px 13px;
    border-radius: 3px;
    text-transform: uppercase;
  }
  a.active,a:hover{
    background:white;
    color: #179942;
    transition: .5s;
  }
  .checkbtn{
    font-size: 30px;
    color: white;
    float: right;
    line-height: 80px;
    margin-right: 40px;
    cursor: pointer;
    display: none;
  }
  #check{
    display: none;
  }

  nav ul li ul li{
      display:none;
  }

  nav ul li:hover ul li{
    display: inline-block;
}
  @media (max-width: 952px){
    label.logo{
      font-size: 30px;
      padding-left: 50px;
    }
    nav ul li a{
      font-size: 16px;
    }
  }
  @media (max-width: 858px){
    .checkbtn{
      display: block;
    }
    ul{
      position: fixed;
      width: 100%;
      height: 100vh;
      background: #2c3e50;
      top: 80px;
      left: -100%;
      text-align: center;
      transition: all .5s;
    }
    nav ul li{
      display: block;
      margin: 50px 0;
      line-height: 30px;
    }
    nav ul li a{
      font-size: 20px;
    }
    a:hover,a.active{
      background: none;
      color: #179942;
    }
    
    #check:checked ~ ul{
      left: 0;
    }
  }
  section{
    background: url(bg1.jpg) no-repeat;
    background-size: cover;
    height: calc(100vh - 80px);
  }

  
<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Time Saving Solutions :: Tisaso</title>
    <link  rel="stylesheet" href="style.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css"/>
</head>
  <body>
    <div id="header">
        <nav>
            <input type="checkbox" id="check">
            <label for="check" class="checkbtn">
                <i class="fas fa-bars"></i>
            </label>
            <label class="logo">Tisaso.</label>
            <ul>
                <li><a class="active" href="#">Home</a></li>
                <li><a href="#">About</a></li>
                <li><a href="#">Products</a>
                    <ul>
                        <li><a href="#" > IT Statement Preperer</a></li>
                        <li><a href="#" > IT Statement Preperer</a></li>
                    </ul>
                </li>
                <li><a href="#">Contact</a></li>
                <li><a href="#">Feedback</a></li>                
            </ul>
            
        </nav>
    <section></section>
</div>
  </body>
</html>

像这样。因为“显示:inline-block”在下拉列表中使用 tag.i 修改并添加一些 css 关于下拉列表。

*{
        padding: 0;
        margin: 0;
        text-decoration: none;
        list-style: none;
        box-sizing: border-box;
      }
      body{
        font-family: montserrat;
        background-image:url("background.png")
      }
      nav{
        background: #179942;
        height: 80px;
        width: 100%;
      }
      label.logo{
        color: white;
        font-size: 35px;
        line-height: 80px;
        padding: 0 100px;
        font-weight: bold;
      }
      nav ul{
        float: right;
        margin-right: 20px;
      }
      nav ul li{
        display: inline-block;
        line-height: 80px;
        margin: 0 5px;
      }
      nav ul li a{
        color: white;
        font-size: 17px;
        padding: 7px 13px;
        border-radius: 3px;
        text-transform: uppercase;
      }
      a.active,a:hover{
        background:white;
        color: #179942;
        transition: .5s;
      }
      .checkbtn{
        font-size: 30px;
        color: white;
        float: right;
        line-height: 80px;
        margin-right: 40px;
        cursor: pointer;
        display: none;
      }
      #check{
        display: none;
      }

      nav ul li ul li{
          display:none;
      }

      nav ul li:hover ul li{
        display: inline-block;
      }
      /*CSS FOR DROPDOWN*/
      nav ul li > ul {
        float: unset;
        position: absolute;
        top: 80px;
        margin: 0;
        display: none;
        background-color: #179942;
      }

        nav ul li  ul li {
            display: block !important;
            line-height: 44px;
        }

        nav ul li:hover > ul {
            display: block;
            padding: 15px 10px;
        }

     section{
        background: url(bg1.jpg) no-repeat;
        background-size: cover;
        height: calc(100vh - 80px);
      }
      @media (max-width: 952px){
        label.logo{
          font-size: 30px;
          padding-left: 50px;
        }
        nav ul li a{
          font-size: 16px;
        }
      }
      @media (max-width: 858px){
        .checkbtn{
          display: block;
        }
        ul{
          position: fixed;
          width: 100%;
          height: 100vh;
          background: #2c3e50;
          top: 80px;
          left: -100%;
          text-align: center;
          transition: all .5s;
        }
        nav ul li{
          display: block;
          margin: 50px 0;
          line-height: 30px;
        }
        nav ul li a{
          font-size: 20px;
        }
        a:hover,a.active{
          background: none;
          color: #179942;
        }
        
        #check:checked ~ ul{
          left: 0;
        }
        nav ul li > ul {
            position: relative;
            top: 0;
            left: 0;
            background: #2c3e50;
        }

        nav ul li > ul li {
            display: block !important;
        }
      }
<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Time Saving Solutions :: Tisaso</title>
    <link  rel="stylesheet" href="style.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css"/>
</head>
  <body>
    <div id="header">
        <nav>
            <input type="checkbox" id="check">
            <label for="check" class="checkbtn">
                <i class="fas fa-bars"></i>
            </label>
            <label class="logo">Tisaso.</label>
            <ul>
                <li><a class="active" href="#">Home</a></li>
                <li><a href="#">About</a></li>
                <li><a href="#">Products</a>
                    <ul>
                        <li><a href="#" > IT Statement Preperer</a></li>
                        <li><a href="#" > IT Statement Preperer</a></li>
                    </ul>
                </li>
                <li><a href="#">Contact</a></li>
                <li><a href="#">Feedback</a></li>                
            </ul>
            
        </nav>
    <section></section>
</div>
  </body>
</html>