1 回答
0
不要使用select打开链接,使用下拉菜单作为您希望代码与<a>标签一起工作的方式。
可以使用Javascript来切换下拉菜单
* {
box-sizing: border-box
}
a {
text-align: center;
display: block;
}
.hoverShow {
display: none;
position: absolute;
width: 100%;
top: 40px;
left: 0;
border: 2px solid black;
}
.subMenuSelect {
border: 2px solid black;
margin: 2rem auto;
padding: 5px;
text-align: center;
background: rgb(255, 255, 255);
justify-content: center;
align-items: center;
font-weight: bold;
display: flex;
font-size: 1.5rem;
position: relative;
}
.subMenuSelect:hover .hoverShow {
display: block;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js'></script>
<script src="./script.js"></script>
<title>Document</title>
</head>
<body>
<div class="subMenuSelect form-control d-block d-lg-none mb-2" aria-label="Sidebar page navigation" id='SelectOption'>Hover Here
<div class="hoverShow">
<a href="#">FAQ</a>
<a href="#">About us</a>
<a href="#">News</a>
<a href="#">Track your order</a>
<a href="#">Shipping & Handling</a>
<a href="#">Refund & Return</a>
<a href="#">Terms of Service</a>
<a href="#">Privacy Policy</a>
<a href="#">Contact us</a>
</div>
</div>
</body>
</html>
于 2021-09-17T19:02:32.393 回答