欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 健康 > 美食 > 构建一个导航栏web

构建一个导航栏web

2025/4/19 17:22:42 来源:https://blog.csdn.net/2303_77676127/article/details/143512189  浏览:    关键词:构建一个导航栏web
<!DOCTYPE html>
<html><head><meta charset="utf-8"><title></title><style>*{margin: 0;padding: 0;}#menu{background-color:purple;width: 100px;height: 50px;}.item{float: left;/* 浮动标签可以让块标签,处于同一行 */width: 100px;height: 50px;line-height: 50px;text-align: center;color: white;position: relative;}.item:hover{background-color: red;}#container{width: 720px;margin: auto;}.down>div{color:black;}.down{background-color:#ccc;display: none;position: absolute;}.item:hover>.down{display: block;width:100px;top: 50px;left: 0px;}</style></head><body><div id="menu"><div id="container"><div class="item">游戏1<div class="down"><!-- 要是需要多个就不能用id,id只能用一次,复制多个得用class --><div>下载</div><div>交易</div><div>外挂</div><div>攻略</div></div></div><div class="item">游戏2<div class="down"><!-- 要是需要多个就不能用id,id只能用一次,复制多个得用class --><div>下载</div><div>交易</div><div>外挂</div><div>攻略</div></div></div><div class="item">游戏3<div class="down"><!-- 要是需要多个就不能用id,id只能用一次,复制多个得用class --><div>下载</div><div>交易</div><div>外挂</div><div>攻略</div></div></div><div class="item">游戏4<div class="down"><!-- 要是需要多个就不能用id,id只能用一次,复制多个得用class --><div>下载</div><div>交易</div><div>外挂</div><div>攻略</div></div></div><div class="item">游戏5<div class="down"><!-- 要是需要多个就不能用id,id只能用一次,复制多个得用class --><div>下载</div><div>交易</div><div>外挂</div><div>攻略</div></div></div><div class="item">游戏6<div class="down"><!-- 要是需要多个就不能用id,id只能用一次,复制多个得用class --><div>下载</div><div>交易</div><div>外挂</div><div>攻略</div></div></div><div class="item">游戏7<div class="down"><!-- 要是需要多个就不能用id,id只能用一次,复制多个得用class --><div>下载</div><div>交易</div><div>外挂</div><div>攻略</div></div></div><div class="item">游戏2</div><div class="item">游戏3</div><div class="item">游戏4</div><div class="item">游戏5</div><div class="item">游戏6</div><div class="item">游戏7</div></div></div></body>
</html>

代码如上;

代码实现效果如下所示:

 

73ee1c0781b84423a9087abc0ba961ff.png

 

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

热搜词