在每个“Something”下,应该有两个子菜单彼此相邻。该死的,我几个小时都在挣扎。
我的HTML到目前为止。
<!DOCTYPE html>
<html>
<head>
<style>
#whatever div {
float:left;
width: 100%;
}
#test {
width:30%;
display:inline-block;
}
.dropdown {
position:relative;
display: inline-block;
}
.dropdown-content {
display: none;
position: relative;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
}
.dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
}
.dropdown-content a:hover {background-color: #f1f1f1}
.dropdown:hover .dropdown-content {
display: block;
}
.dropdown:hover .dropbtn {
background-color: #3e8e41;
}
</style>
<div id="whatever">
<span id="test">Something</span>
<div class="dropdown">
<button class="dropbtn">ULL</button>
<div class="dropdown-content">
<a href="#">Link 1</a>
<a href="#">Link 2</a>
<a href="#">Link 3</a>
</div>
</div>
<span id="test">Something</span>
<span id="test">Something</span>
</div>
</body>
</html>
所以基本上,正如你所看到的,我需要在ULL下添加另一个子菜单,我需要在Something title下做同样的事情
答案 0 :(得分:0)
(上个版) 注意:
以下是代码:
<!DOCTYPE html>
<html>
<head>
<style>
#whatever div {
float: left;
width: 100%;
}
.test {
width: 30%;
display: inline-block;
}
.dropdown {
display: inline-block;
}
.dropdown-content {
display: none;
position: absolute;
min-width: 160px;
box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.2);
}
.dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
}
.dropdown-content a:hover {
background-color: #f1f1f1
}
.dropdown:hover .dropdown-content {
display: block;
}
.dropdown:hover .dropbtn {
background-color: #3e8e41;
}
</style>
<body>
<div id="whatever">
<span class="test">Something</span>
<div class="dropdown">
<button class="dropbtn">ULL</button>
<div class="dropdown-content">
<a href="#">Link 1</a>
<a href="#">Link 2</a>
<a href="#">Link 3</a>
</div>
</div>
<div class="dropdown">
<button class="dropbtn" style="position: absolute;top: 26px;left: 50px;">ULL</button>
<div class="dropdown-content">
<a href="#">Link 1</a>
<a href="#">Link 2</a>
<a href="#">Link 3</a>
</div>
</div>
<span class="test">Something</span>
<div class="dropdown">
<button class="dropbtn" style="position: absolute;top: 26px;left: 410px;">ULL</button>
<div class="dropdown-content">
<a href="#">Link 1</a>
<a href="#">Link 2</a>
<a href="#">Link 3</a>
</div>
</div>
<div class="dropdown">
<button class="dropbtn" style="position: absolute;top: 26px;left: 450px;">ULL</button>
<div class="dropdown-content">
<a href="#">Link 1</a>
<a href="#">Link 2</a>
<a href="#">Link 3</a>
</div>
</div>
<span class="test">Something</span>
<div class="dropdown">
<button class="dropbtn" style="position: absolute;top: 26px;left: 820px;">ULL</button>
<div class="dropdown-content">
<a href="#">Link 1</a>
<a href="#">Link 2</a>
<a href="#">Link 3</a>
</div>
</div>
<div class="dropdown">
<button class="dropbtn" style="position: absolute;top: 26px;left: 860px;">ULL</button>
<div class="dropdown-content">
<a href="#">Link 1</a>
<a href="#">Link 2</a>
<a href="#">Link 3</a>
</div>
</div>
</div>
</body>
</html>
&#13;