第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

為什么我的鏈接沒(méi)有顯示在中心?

為什么我的鏈接沒(méi)有顯示在中心?

智慧大石 2023-10-24 15:53:49
我正在學(xué)習(xí) html css,現(xiàn)在我想創(chuàng)建導(dǎo)航欄作為我的任務(wù)。因此,當(dāng)我嘗試創(chuàng)建水平導(dǎo)航欄時(shí),我的菜單沒(méi)有顯示在導(dǎo)航欄 div 的中心?為什么它與頂角相連?我希望它們從頂部和底部居中,這是我的代碼,糾正我的錯(cuò)誤* {  margin: 0;  padding: 0;}nav {  background-color: red;}ul {  list-style: none;  height: 35px;  background-color: purple;  width: 50%;}nav ul li {  display: inline;  padding: 10px;  margin-top: 10px;}nav ul li a {  text-decoration: none;  color: black;}nav ul li:hover {  background-color: blue;}<nav>  <ul>    <li> <a href="">Home</a></li>    <li> <a href="">About Us</a></li>    <li> <a href="">Contact Us</a></li>    <li> <a href="">Privacy Policy</a></li>  </ul></nav>
查看完整描述

3 回答

?
倚天杖

TA貢獻(xiàn)1828條經(jīng)驗(yàn) 獲得超3個(gè)贊

這是您可以執(zhí)行的操作,flex如果需要,您可以使用和調(diào)整您的代碼。


body {

  margin: 0;

  padding: 0;

  justify-content: center;

  text-align: center;

  display: flex;

}


nav {

  background-color: red;

}


ul {

  justify-content: center;

  text-align: center;

  list-style: none;

  height: 35px;

  background-color: purple;

  width: 50%;

  display: flex;

  flex-direction: row;

}


ul li {

  margin-top: 10px;

}


ul li a {

  text-decoration: none;

  color: black;

  padding: 5px;

}


ul li:hover {

  background-color: blue;

}

<ul>

  <li> <a href="">Home</a></li>

  <li> <a href="">About Us</a></li>

  <li> <a href="">Contact Us</a></li>

  <li> <a href="">Privacy Policy</a></li>

</ul>


查看完整回答
反對(duì) 回復(fù) 2023-10-24
?
ABOUTYOU

TA貢獻(xiàn)1812條經(jīng)驗(yàn) 獲得超5個(gè)贊

我向 li 和 ul添加了display:inline-block ,向 nav添加了 text-align:center 。這將成為利潤(rùn)最高的作品。


* {

  margin: 0;

  padding: 0;

}


nav {

  text-align: center

}


ul {

  list-style: none;

  height: 35px;

  background-color: purple;

  width: 50%;

  display: inline-block

}


nav ul li {

  display: inline-block;

  padding: 10px;

}


nav ul li a {

  text-decoration: none;

  color: black;

}


nav ul li:hover {

  background-color: blue;

}

<nav>

  <ul>

    <li> <a href="">Home</a></li>

    <li> <a href="">About Us</a></li>

    <li> <a href="">Contact Us</a></li>

    <li> <a href="">Privacy Policy</a></li>

  </ul>

</nav>


查看完整回答
反對(duì) 回復(fù) 2023-10-24
?
躍然一笑

TA貢獻(xiàn)1826條經(jīng)驗(yàn) 獲得超6個(gè)贊

您需要添加一個(gè)

test-align: center;

到你的ulCSS元素。


查看完整回答
反對(duì) 回復(fù) 2023-10-24
  • 3 回答
  • 0 關(guān)注
  • 166 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢(xún)優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)