我正在爲剛剛創業的朋友製作這個簡單的工作列表/客戶端/股票管理平臺。下拉菜單樣式的CSS菜單
它正在建立在HTML,PHP和CSS。
我面臨的問題是頁面CSS。 子菜單的寬度正在縮小,無法更改。 該菜單是基於w3schools的例子,在這裏和那裏我發現googling/SO搜索。但找不到原因和如何解決我的問題。
body {
margin: 0;
}
ul {
list-style-type: none;
position: fixed;
top: 0;
width: 100%;
margin: 0;
padding: 0;
background-color: #003366;
}
li {
display: inline-block;
position: relative;
float: left;
}
li a,
.dropbtn {
display: inline-block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
li a:hover,
.dropdown:hover .dropbtn {
background-color: #0066CC;
}
li.dropdown {
display: inline-block;
border-right: 1px solid #bbb;
}
li.right {
float: right;
}
.arrow {
font-size: 8px;
line-height: 0%;
}
.dropdown-content {
display: none;
position: absolute;
top: 100%;
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: 12px 16px;
text-decoration: none;
display: block;
text-align: left;
}
.dropdown-content a:hover {
background-color: #f1f1f1
}
.dropdown:hover .dropdown-content {
display: block;
}
<!-- Header -->
<header id="header">
<nav id="nav">
<ul>
<li class="dropdown">
<a href="#" class="dropbtn">Reparações <span class="arrow">▼</span></a>
<div class="dropdown-content">
<a href="#">Adicionar Pedidos de Reparação</a>
</div>
</li>
<li class="dropdown">
<a href="#" class="dropbtn">Clientes <span class="arrow">▼</span></a>
<div class="dropdown-content">
<a href="#">Adicionar Cliente</a>
</div>
</li>
<li class="dropdown">
<a href="#" class="dropbtn">Stocks <span class="arrow">▼</span></a>
<div class="dropdown-content">
<a href="#">Adicionar Stock</a>
</div>
</li>
<li class="right"><a href="#">Deltronic</a></li>
</ul>
</nav>
</header>
<!-- Header -->
<p> weeeeeeeeeee </p>
<p> weeeeeeeeeee </p>
<p> weeeeeeeeeee </p>
<p> weeeeeeeeeee </p>
<p> weeeeeeeeeee </p>
<p> weeeeeeeeeee </p>
<p> weeeeeeeeeee </p>
<p> weeeeeeeeeee </p>
<p> weeeeeeeeeee </p>
<p> weeeeeeeeeee </p>
<p> weeeeeeeeeee </p>
<p> weeeeeeeeeee </p>
<p> weeeeeeeeeee </p>
<p> weeeeeeeeeee </p>
<p> weeeeeeeeeee </p>
<p> weeeeeeeeeee </p>
<p> weeeeeeeeeee </p>
<p> weeeeeeeeeee </p>
<p> weeeeeeeeeee </p>
<p> weeeeeeeeeee </p>
<p> weeeeeeeeeee </p>
<p> weeeeeeeeeee </p>
<p> weeeeeeeeeee </p>
<p> weeeeeeeeeee </p>
<p> weeeeeeeeeee </p>
<p> weeeeeeeeeee </p>
我已設置jsfiddle例子爲好。
希望有人能幫助我理解爲什麼它會發生這樣的事情,並最終實現我所追求的結果。
我不能面對你的問題。你可以添加圖像的例子來展示預期的外觀與外觀相比嗎? –