为什么列表的左侧比右侧大?

时间:2013-12-29 17:55:03

标签: html css html-lists

我不知道为什么但是如果你运行这个代码,导航栏的左侧比右侧有点大,有人可以告诉我为什么?看起来我没有在左边添加任何额外的列表项。提前致谢。

<!DOCTPYE html>
<html>
<head>
<style>
html {
    height: 100%;
    width: 100%;
    font: 25 calibri;
    text-align: center;
    background: linear-gradient(black,white);
}
#mainContent {
    margin: 0 auto;
    margin-top: -25px; 
    width: 800px;
    background-color: white;
    height: 1000px;
}
a:link, a:visited {
    text-decoration: none;
    color: grey;
}
a:hover {
    color: #ccc;
}
li {
    display: inline-block;
}
nav {
    margin: 0 auto;
    margin-top: 60px;
    width: 720px;
    background-color: brown;
    text-align: center;
}
</style>
</head>
<body>
    <nav>
        <ul>
            <li id="currentPage"><a href="index.html"><b>HOME</b></a></li>
            <li>|</li>
            <li><a href="updates.html">UPDATES</a></li>
            <li>|</li>
            <li><a href="tournaments.html">TOURNAMENTS</a></li>
            <li>|</li>
            <li><a href="recruitments.html">RECRUITMENTS</a></li>
            <li>|</li>
            <li><a href="contact.html">CONTACT</a></li>
        </ul>
    </nav>
    <div id="mainContent">
    </div>
</body>
</html>

1 个答案:

答案 0 :(得分:2)

将此样式用于列表

ul{
  padding:0;
  list-style-type:none;
}

然后检查并告诉我。

相关问题