jQuery+css 下拉列表
主要代码
<!DOCTYPE html>
<html>
<head >
<meta charset="UTF-8">
<title></title>
<script src="js/jquery.js"></script>
<style>
.dropdown {
position: relative;
display: inline-block;
height: 30px;
width: 70px;
background-color: pink;
text-align: center;
font-size: 15px;
}
.dropdown:hover {
position: relative;
display: inline-block;
height: 30px;
width: 70px;
background-color: mediumpurple;
text-align: center;
font-size: 15px;
}
.dropdown-content {
display: none;
position: absolute;
height: 30px;
width: 70px;
background-color: mediumpurple;
text-align: center;
z-index: 1;
font-size: 15px;
}
.dropdown:hover .dropdown-content {
display: block;
height: 120px;
width: 70px;
background-color: mediumpurple;
text-align: center;
font-size: 15px;
top: 30px;
}
.dropdown1 {
position: relative;
display: inline-block;
height: 30px;
width: 70px;
background-color: pink;
text-align: center;
font-size: 15px;
}
.dropdown1:hover {
position: relative;
display: inline-block;
height: 30px;
width: 70px;
background-color: mediumpurple;
text-align: center;
font-size: 15px;
}
.dropdown-content1 {
display: none;
position: absolute;
height: 30px;
width: 70px;
background-color: pink;
text-align: center;
z-index: 1;
font-size: 15px;
}
.dropdown1:hover .dropdown-content1 {
display: block;
height: 120px;
width: 70px;
background-color: mediumpurple;
text-align: center;
font-size: 15px;
top: 30px;
}
.dropdown2 {
position: relative;
display: inline-block;
height: 30px;
width: 70px;
background-color: pink;
text-align: center;
font-size: 15px;
}
.dropdown2:hover {
position: relative;
display: inline-block;
height: 30px;
width: 70px;
background-color: mediumpurple;
text-align: center;
font-size: 15px;
}
.dropdown-content2 {
display: none;
position: absolute;
height: 30px;
width: 70px;
background-color: red;
text-align: center;
z-index: 1;
font-size: 15px;
}
.dropdown2:hover .dropdown-content2 {
display: block;
height: 120px;
width: 70px;
background-color: pink;
text-align: center;
font-size: 15px;
top: 30px;
}
</style>
</head>
<body>
<div class="dropdown">
<table>
<tr><td><span>班级</span></td></tr>
</table>
<div class="dropdown-content">
<p>软件1805</p>
<p>软件1806</p>
<p>软件1807</p>
</div>
</div>
<div class="dropdown1">
<table>
<tr><td><span>专业</span></td></tr>
</table>
<div class="dropdown-content1">
<p>软件技术</p>
<p>软件技术</p>
<p>软件技术</p>
</div>
</div>
</body>
</html>