0

Weebly を使用して Web サイトを作成しています。ナビゲーション バーを変更して、左揃えではなく中央に表示されるようにしました。私はコードをまったく知りませんが、ナビゲーション コードを見つけたので、バーを中央に配置するには何を変更すればよいか考えていました。ありがとう!

#nav-wrap .nav {
float:left;
}

#nav-wrap .container {
clear: both;
overflow: hidden;
position: relative;
background:url(saperator-h.png) repeat-x bottom;
padding-bottom:40px;
}

#nav-wrap .container ul {
list-style: none;
}

#nav-wrap .container ul li {
list-style: none;
float: left;
background:url(nav-saperator.png) no-repeat right center;
margin-right: 10px;
padding-right: 25px;
}

#nav-wrap .container ul > li:last-child, #nav-wrap .container ul span:last-child li {
background:none;
}

#nav-wrap .container ul li a {
display: block;
line-height:14px;
border: 0;
outline: 0;
list-style-type: none;
text-transform:uppercase;
padding:5px;
margin-bottom:4px;
}

#nav-wrap .container ul li#active a,
#nav-wrap .container ul li a:hover {
color:#000;
}
4

3 に答える 3

0
#topnav a {
float: left;
display: block;
color: #fff;
font-size: 1.2em;
text-decoration: none;
padding: 11px 60px 60px 15px;
border: 0;
outline: 0;
text-transform: uppercase;

パディングをいじる必要がありましたが、これによりナビゲーションバーがweeblyの中央に配置されました

于 2013-08-15T05:35:04.413 に答える
0
#nav-wrap {
position: relative;
width: /*set width, can't be 100% obivously if you want it centered */
margin: auto;
}

これは推測です。HTML は表示されません。これをナビゲーション バー全体のコンテナに適用します。

于 2013-01-29T05:04:06.537 に答える
0

HTML 構造に依存しますが、これでうまくいく可能性があります。

#nav-wrap .container ul {
  display:block;
  width:auto;
  margin:auto;
}
于 2013-01-29T05:08:25.603 に答える