实现下列图片的效果
代码:
html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style>
* {
margin: 0;
padding: 0;
}
#menu {
background-color: #0c0048;
width: 100%;
height: 50px;
margin: auto;
}
.item {
float: left;
width: 100px;
height: 50px;
line-height: 50px;
text-align: center;
color: white;
position: relative;
}
.item:hover {
background-color: red;
color: gold;
}
#container {
width: 720px;
margin: auto;
}
.down_menu {
background-color: #cccccc;
display: none;
position: absolute;
}
.down_menu>div {
color: black;
}
.item:hover>.down_menu {
display: block;
width: 100px;
left: 0px;
top: 50px;
}
</style>
</head>
<body>
<div id="menu">
<div id="container">
<div class="item">游戏1
<div class="down_menu">
<div>游戏下载</div>
<div>游戏交易</div>
<div>游戏外挂</div>
<div>游戏攻略</div>
</div>
</div>
<div class="item">游戏2
<div class="down_menu">
<div>游戏插件</div>
<div>游戏聊天</div>
<div>邀请好友</div>
<div>自定义房间</div>
</div>
</div>
<div class="item">游戏3
<div class="down_menu">
<div>游戏下载</div>
<div>游戏交易</div>
<div>游戏外挂</div>
<div>游戏攻略</div>
</div>
</div>
<div class="item">游戏4
<div class="down_menu">
<div>游戏下载</div>
<div>游戏交易</div>
<div>游戏外挂</div>
<div>游戏攻略</div>
</div>
</div>
<div class="item">游戏5
<div class="down_menu">
<div>游戏下载</div>
<div>游戏交易</div>
<div>游戏外挂</div>
<div>游戏攻略</div>
</div>
</div>
<div class="item">游戏6
<div class="down_menu">
<div>游戏下载</div>
<div>游戏交易</div>
<div>游戏外挂</div>
<div>游戏攻略</div>
</div>
</div>
<div class="item">游戏7
<div class="down_menu">
<div>游戏下载</div>
<div>游戏交易</div>
<div>游戏外挂</div>
<div>游戏攻略</div>
</div>
</div>
</div>
</div>
</body>
</html>