html练习2
实现下列图片的效果
代码:
<!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>
效果展示:
原文地址:https://blog.csdn.net/2203_75363877/article/details/143507935
免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!