body{
background: #f2f2f2;
font-family: Metrophobic, Arial, serif;
margin:0;
padding:0;
}
#nav{
width:60%;
margin:auto;
}
#topnav{
width:100%;
height:50px;
background: #009688;
display: block;
}
a{
margin: 0px;
text-decoration: none;
color: black;
}
a:visited{
text-decoration: none;
color: black;
}
a:hover{
text-decoration: underline;
color: #f2f2f2;
}
#navl{
float:left;
}
#navr{
float:right;
}
#nav ul li{
list-style: none;
float: left;
padding: 0px 15px 0px 0px;
margin: 0px;
}
#nav img{
width:16px;
height:16px;
}
<html>
<head>
<title>First Project</title>
<link href="style.css" rel="stylesheet" type="text/css">
<link src="java.js" type="text/script">
<link href='https://fonts.googleapis.com/css?family=Montserrat:400,700' rel='stylesheet' type='text/css'>
</head>
<body>
<div id="topnav">
<div id="nav">
<div id="navl">
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">Sitemap</a></li>
</ul>
</div>
<div id="navr">
<ul>
<li><a href="#">Login</a></li>
<li><a href="#">FAQ</a></li>
</ul>
</div>
</div>
</div>
</body>
</html>
每个div标签的左侧似乎都有空格。
最佳答案
body{
background: #f2f2f2;
font-family: Metrophobic, Arial, serif;
margin:0;
padding:0;
}
关于javascript - 一些空间,即使将padding和margin设置为0px,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/32665311/