為什麼文字裝飾和導覽列不起作用?
P粉350036783
P粉350036783 2024-04-01 21:40:16
0
1
274

我正在製作一個網頁,但 Navar 和連結有問題。我的納瓦爾物品沒有停留在納瓦爾中,而是飄落下來。另外, text-decoration: none; 不起作用,我的連結帶有下劃線,並且前面有一個點。

.navbar {
  background: black;
  height: 80px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.2rem;
  position: sticky;
  top: 0;
  z-index: 999;
}

.navbar__container {
  display: flex;
  justify-content: space-between;
  height: 80px;
  z-index: 1;
  width: 100%;
  max-width: 1300px;
  margin: 0 auto;
  padding: 0 50px;
}

.navbar__menu {
  display: flex;
  flex-direction: row;
  align-items: center;
  list-style: none;
}

.navbar__item {
  height: 80px;
}

.navbar__links {
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 125px;
  text-decoration: none;
  height: 100%;
  transition: all 0.3s ease;
}
<nav class="navbar">
  <div class="navbar__container">
    <a href="#home" id="navbar__logo"> COLOR</a>
    <div class="navbar__toggle" id="mobile-menu">
      <span class="bar"></span>
      <span class="bar"></span>
      <span class="bar"></span>
    </div>
    <ul class="nabar__menu">
      <li class="navbar__item">
        <a href="#home" class="nabvar__links" id="hope-page">HOME</a>
      </li>
      <li class="navbar__item">
        <a href="#about" class="nabvar__links" id="about-page">ABOUT</a>
      </li>
      <li class="navbar__item">
        <a href="#services" class="nabvar__links" id="services-page">SERVICES</a>
      </li>
      <li class="navbar__btn">
        <a href="#sign-up" class="button" id="signup">SIGN UP</a>
      </li>
    </ul>
  </div>
</nav>

我嘗試了 border-bottom: nonelist-style-type: none; 不起作用。 對於導覽欄,我嘗試了 flex-direction: row,也不起作用。

P粉350036783
P粉350036783

全部回覆(1)
P粉486743671

navbar__links navbar__menu 這兩個類別名稱在 HTML 中拼字錯誤

.navbar {
  background: black;
  height: 80px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.2rem;
  position: sticky;
  top: 0;
  z-index: 999;
}

.navbar__container {
  display: flex;
  justify-content: space-between;
  height: 80px;
  z-index: 1;
  width: 100%;
  max-width: 1300px;
  margin: 0 auto;
  padding: 0 50px;
}

.navbar__menu {
  display: flex;
  flex-direction: row;
  align-items: center;
  list-style: none;
}

.navbar__item {
  height: 80px;
}

.navbar__links {
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 125px;
  text-decoration: none;
  height: 100%;
  transition: all 0.3s ease;
}
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!