首页 > 解决方案 > 如何在导航栏上的“服务”下方的导航栏中移动 SEO 和 PPC

问题描述

代码

@import url("https://fonts.googleapis.com/css2?family=Lato:wght@100;300;700&family=Poppins:wght@100;200;500;700&display=swap");
body {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.navbar {
  background-color: beige;
}

nav {
  display: flex;
  align-items: center;
  justify-content: center;
}

.img {
  width: 110px;
  margin-left: 150px;
  margin-top: 10px;
}

nav ul li {
  list-style: none;
  cursor: pointer;
  display: inline-block;
  margin: 0 20;
  padding-right: 40px;
  font-family: "Poppins", sans-serif;
  font-weight: 200;
  font-size: 1.2rem;
}

nav ul li:hover {
  font-weight: 700;
}

.cta a {
  text-decoration: none;
}

.container {
  display: flex;
  justify-content: space-between;
  width: 100%;
}

.btn-primary {
  margin-top: 2.1rem;
  margin-left: 0;
  margin-right: 8rem;
  margin-bottom: 40px;
  padding: 1rem;
  background-color: #ee5f22;
  color: white;
  font-family: "Poppins", sans-serif;
  font-weight: 700;
  border-radius: 7%;
  font-size: 1.1rem;
  padding: 0px 20px;
  border: none;
}

.btn-primary:hover {
  border: 1.5px solid black;
  cursor: pointer;
}

.downArrow {
  color: #ee5f22;
  transform: rotate(90deg);
  display: inline-block;
}

.services {
  display: inline-block;
}

.services li {
  display: block;
}
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>HZ Digital Agency</title>
  <link rel="stylesheet" href="main.css">
</head>

<body>
  <header>
    <div class="navbar">
      <div class="container">
        <img src="imgs/Logo.png" alt="" class="img">

        <nav>
          <ul>
            <li>
              <a href="index.html"></a>Home</li>
            <li>
              <a href="whowehelp.html"></a>Who We Help</li>
            <li>
              <a href="services.html"></a>Services
              <span class="downArrow">&#62;</span>
            </li>
            <li>
              <a href="technology.html"></a>Technology
              <span class="downArrow">&#62;</span>
            </li>
            <ul class="services">
              <li><a href="SEO.html">SEO</a></li>
              <li><a href="PPC.html">PPC</a></li>
              <li>
                <a href=""></a>
              </li>
              <li>
                <a href=""></a>
              </li>
              <li>
                <a href=""></a>
              </li>
              <li>
                <a href=""></a>
              </li>
              <li>
                <a href=""></a>
              </li>
            </ul>
            <li>
              <a href="company.html"></a>Company</li>

          </ul>
        </nav>

        <div class="cta"></div>
        <button class="btn btn-primary">Contact Us</button>
      </div>
    </div>
    </div>
  </header>






  <script src="main.js"></script>
</body>

</html>

我如何将<ul>包含“PPC”和“SEO”的内容放在服务 UL 下,这样它就在它的正下方,我尝试使用负边距,但这可行,但它不适合响应式设计。知道如何实现吗?我也尝试过删除 ul 标签并将其设置为 li 但它仍然无法正常工作。

标签: htmlcss

解决方案


推荐阅读