1
我是相當新的HTML和CSS,所以很抱歉,如果這是一個相當明顯的問題我的導航欄居中,直到我添加引導類,任何人都可以幫我解決什麼是導致這種衝突?如何將導航中心對齊?
ul {
margin: 0;
padding: 0;
text-align: center;
position: relative;
display: inline-block;
}
li {
display: inline;
list-style: none;
height: 100px;
line-height: 100px;
}
ul li {
height: 100px;
}
a:link,
a:visited {
display: inline-block;
margin-right: -4px;
width: 120px;
font-weight: bold;
color: black;
text-align: center;
padding: 4px;
text-decoration: none;
text-transform: uppercase;
}
#circle {
background-color: #AAAAAA;
border-radius: 50%;
display: inline-block;
width: 100px;
height: 100px;
}
#nav {
padding-top: 10px;
padding-bottom: 10px;
}
.line {
text-decoration: overline;
text-align: center;
vertical-align: middle;
display: inline;
}
#full {
width: 100%;
text-align: center;
}
#K {
color: white;
font-size: 48px;
font-family: 'Lucida Sans Typewriter', 'Lucida Console', monaco, 'Bitstream Vera Sans Mono', monospace;
}
.box {
display: inline;
padding-left: 30px;
padding-right: 30px;
}
<div id="full" class="row">
<ul id="nav">
<li>
<div class="box col-md-2 col-sm-2 col-xs-12">
<a href=csshomepage.html>
<p class="line">About </p>
</a>
</div>
</li>
<li>
<div class="box col-md-2 col-sm-2 col-xs-12">
<a href="#images">
<p class="line">Projects </p>
</a>
</div>
</li>
<li>
<div class="box col-md-4 col-sm-4 hidden-xs" id="circle">
<a href="#images">
<p id="K">K</p>
</a>
</div>
</li>
<li>
<div class="box col-md-2 col-sm-2 col-xs-12">
<a href="#links">
<p class="line">Examples </p>
</a>
</div>
</li>
<li>
<div class="box col-md-2 col-sm-2 col-xs-12">
<a href="#links">
<p class="line">Contact </p>
</a>
</div>
</li>
</ul>
</div>
如果你想使用bootstrap,你應該檢查他們的網站。在組件下查找導航欄。 –