我想创建一个菜单,每当您将鼠标悬停在菜单中的“按钮”上时,它都会显示一些文本,但是在 css 中执行此操作时会出现问题。
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<link type = "text/css" rel = "stylesheet" href = "home.css"/>
</head>
<body>
<div id = "menu">
<a class = "button"><span>222</span></a>
<a class = "button"><span>222</span></a>
<a class = "button"><span>222</span></a>
<a class = "button"><span>222</span></a>
<a class = "button"><span>222</span></a>
<a class = "button"><span>222</span></a>
<a class = "button"><span>222</span></a>
<a class = "button"><span>222</span></a>
</div>
<span class = "box_menu"><p>asfqwqs</p></span>
</body>
</html>
css
#menu {
width:70%;
height:35px;
margin:0 auto;
border-radius:0px 0px 3px 3px;
box-shadow:1px 2px 3px 2px #1F0000;
}
body{
background-color:#562500;
background:url('image_for_website.jpg') repeat;
}
a.button{
display:inline;
position:relative;
font-size:12px;
font-family:"Comic Sans MS", cursive, sans-serif;
color:white;
height:26px;
}
a.button span {
display: block;
line-height: 30px;
border-right:1px solid rgb(0,0,0);
float:left;
width:10%;
padding:3px;
}
a.button:hover span{
background:rgba(0,0,0,0.3);
cursor: pointer;
}
a.box_menu{
position:absolute;
display:none;
width:20px;
border:1px solid #333333;
color:white;
font-size:12px;
font-family:"Comic Sans MS", cursive, sans-serif;
background:rgba(2,2,2,0.7);
margin-top:18%;
margin-left:15%;
border:1px solid white;
}
a.box_menu:hover span{
display:block;
}
所以,每当我将鼠标悬停在锚类按钮的跨度上时(比如说第一个),我想要一个文本框,它本质上是一个带有 box_menu 类的跨度到 apper。那么我该怎么做呢?请帮助。提前谢谢.