1
如何爲我的兩個材質圖標列表添加下拉菜單?我設法完成了html部分。我通過添加下拉代碼在CSS上嘗試了很多次,但它不起作用,下拉菜單卡在導航欄之間。發生了什麼,我能做些什麼來解決這個問題?爲導航欄添加下拉菜單
body {} #nav-main {
width: 1280px;
min-width: 100%;
position: fixed;
top: 0;
left: 0;
}
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: rgba(0, 0, 0, 0.39);
height: 60px;
}
li {
float: left;
}
li a {
display: block;
color: #ffffff;
text-align: center;
padding: 19px 25px;
/*topbottom leftright*/
text-decoration: none;
}
.nav-item5 {
width: 550px;
margin: 15px 60px;
/*topbottom leftright*/
padding: 5px;
}
input[type="search"] {
background: url(../images/search-icon.png) no-repeat #fcfcfc;
border: 1px solid #d1d1d1;
background-size: contain;
padding: 6px 15px 6px 30px;
text-shadow: 0 2px 3px rgba(0, 0, 0, 0.1);
-webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15) inset;
-moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15) inset;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15) inset;
-webkit-transition: all 0.7s ease 0s;
-moz-transition: all 0.7s ease 0s;
-o-transition: all 0.7s ease 0s;
transition: all 0.7s ease 0s;
}
input[type="search"]:focus {
width: 300px;
}
i.material-icons {
font-size: 27px;
}
li a:hover {
background-color: rgba(0, 0, 0, 0.50);
}
<ul id="nav-main">
<li><a href="#" class="nav-item1">Home</a>
</li>
<li><a href="/about" class="nav-item2">About</a>
</li>
<li><a href="/faq" class="nav-item3">FAQ</a>
</li>
<li><a href="/Contact" class="nav-item4">Contact</a>
</li>
<li>
<form action="action_page.php">
<input type="search" name="savanasearch" placeholder="Search..." class="nav-item5">
</form>
</li>
<li style="float:right">
<a href="#"><i class="material-icons">account_circle</i></a>
<div class="dropdown">
Welcome
<ul>
<li><a href="#" class="nav-item6">Login</a>
</li>
<li><a href="#" class="nav-item7">Register</a>
</li>
</ul>
</div>
</li>
<li style="float:right">
<a href="#"><i class="material-icons">favorite_border</i></a>
<div class="dropdown">
<ul>
<li><a href="#" class="nav-item7">Favorites</a>
</li>
<li><a href="#" class="nav-item8">Wishlist</a>
</li>
<li><a href="#" class="nav-item9">Track Order</a>
</li>
</ul>
</div>
</li>
</ul>