我很难摆脱导航栏左侧和顶部的白色小层。我在照片上圈了圈。有任何想法吗?谢谢。我认为这与我处理ul css的位置有关,但我可能是错的。
<!DOCTYPE html>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/pretty-checkbox@3.0/dist/pretty-checkbox.min.css">
<html>
<head>
<style>
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #333;
}
li {
float: left;
}
li a, .dropbtn {
display: inline-block;
color: white;
text-align: center;
padding: 12px 16px;
text-decoration: none;
}
li a:hover, .dropdown:hover .dropbtn {
background-color: rgb(0, 140, 255);
}
li.dropdown {
display: inline-block;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 1;
}
.dropdown-content a {
color: black;
padding: 14px 16px;
text-decoration: none;
display: block;
text-align: left;
}
i {
border: solid black;
border-width: 0 3px 3px 0;
display: inline-block;
padding: 3px;
}
.down {
transform: rotate(45deg);
-webkit-transform: rotate(45deg);
}
.dropdown-content a:hover {background-color: #f1f1f1}
.dropdown:hover .dropdown-content {
display: block;
}
.sidenav {
height: 100%;
width: 160px;
position: fixed;
z-index: 1;
top: 30;
left: 0;
background-color: rgb(20, 24, 29);
overflow-x: hidden;
padding-top: 20px;
}
.sidenav {
padding: 6px 8px 6px 16px;
text-decoration: none;
font-size: 25px;
color: #818181;
display: block;
}
.sidenav {
color: #f1f1f1;
}
.main {
margin-left: 160px; /* Same as the width of the sidenav */
font-size: 28px; /* Increased text to enable scrolling */
padding: 0px 10px;
}
</style>
</head>
<body>
<ul>
<li><a href="/">Kitting Center</a></li>
<li class="dropdown">
<a href="javascript:void(0)" class="dropbtn">Config Master <i class="arrow down"></i></a>
<div class="dropdown-content">
<a href="Option1">Option 1</a>
<a href="Option2">Option 2</a>
</div>
</li>
<li><a href="/add">Firmware Rename</a></li>
<li><a href="/logout">Logout</a></li>
</ul>
<div class="sidenav">
<div class="pretty p-default p-curve">
<input type="radio" name="color" />
<div class="state p-primary-o">
<label>ISP</label>
</div>
</div>
<div class="pretty p-default p-curve">
<input type="radio" name="color" />
<div class="state p-success-o">
<label>MPISP</label>
</div>
</div>
</div>
<div class="main">
<h3>Dropdown Menu inside a Navigation Bar</h3>
<p>Hover over the "Dropdown" link to see the dropdown menu.</p>
</div>
</body>
</html>
答案 0 :(得分:2)
将CSS更改为
html, body {
margin: 0;
padding: 0;
}
答案 1 :(得分:0)
在CSS中添加以下样式,以消除间距:
html, body {
margin: 0;
padding: 0;
}