用HTML+CSS怎么写导航的下拉菜单,代码是什么
Admin 2022-06-14 群英技术资讯 786 次浏览
在这篇文章中,我们来学习一下“用HTML+CSS怎么写导航的下拉菜单,代码是什么”的相关知识,下文有详细的讲解,易于大家学习和理解,有需要的朋友可以借鉴参考,下面就请大家跟着小编的思路一起来学习一下吧。代码中的图片可以自己换的

<header class="header">
<div class="header_left">
<img src="img/logo.jpg">
</div>
<div class="header_right">
<div class="number_right">
<img src="img/number.jpg">
</div>
<ul>
<a href="#"><li>首页</li></a>
<a href="#"><li class="show_list">
<span>成功案例</span>
<ul class="move_list">
<li>品牌设计</li>
<li>网页设计</li>
<li>平面设计</li>
<li>电子商城</li>
<li>空间/建筑</li>
</ul>
</li></a>
<a href="#"><li>我要设计</li></a>
<a href="#"><li>在线咨询</li></a>
<a href="#"><li>会员注册</li></a>
<a href="#"><li>会员登录</li></a>
</ul>
</div>
</header>
.header{
height: 120px;
width: 1046px;
margin: 0 auto;
}
.header_left{
float: left;
line-height: 120px;
}
.header_left img{
width: 300px;
height: 100px;
}
.header_right{
float: right;
height: 120px;
position: relative;
}
.header_right>div{
position: absolute;
top: 0;
right: 0;
}
.header_right ul{
margin-top: 88px;
}
.header_right ul a li{
border-right: 1px solid #000000;
height: 13px;
font-size: 15px;
padding: 0 25px;
font-weight: bold;
color: #666;
}
.header_right ul a{
float: left;
line-height: 13px;
}
.header_right ul a li:hover{
color: #000000;
}
.header_right ul a:last-child li{/*去掉最后的边框*/
border: none;
}
.show_list{
position: relative;
}
.show_list .move_list{
display: none;
z-index: 103;
position: absolute;
top: -56px;
left: 0;
width: 100%;
background: #333;
text-align: center;
}
.show_list .move_list li{
padding: 10px 0;
width: 114px;
color: #fff;
}
.header_right ul a .show_list{
padding-bottom: 20px;
border-right: none;
}
.show_list:hover .move_list{
display: block;
}
.header_right ul a:nth-child(3){
border-left: 1px solid #000;
}
.show_list .move_list li:hover{
color: white;
background: orange;
}
在写完上述代码的同时须加上css的重置代码,代码如下:
* {
margin: 0;
padding: 0
}
em,i {
font-style: normal
}
li {
list-style: none
}
a{
font: 14px/24px Microsoft YaHei,Arial,\\5B8B\4F53,Arial Narrow;
letter-spacing: 1.2px;
color: #666;
text-decoration: none
}
a:hover {
color: #c81623 ;
}
img {
border: 0;
vertical-align: middle
}
input{
outline: none;
}
button {
cursor: pointer;
border:none;
outline: none;
}
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:mmqy2019@163.com进行举报,并提供相关证据,查实之后,将立刻删除涉嫌侵权内容。
猜你喜欢
before 和 after其实就是附着在元素前后的伪元素,说他是伪元素的意思就是,元素不是在DOM中生成的,而是在浏览器渲染引擎渲染CSS的时候画上去的,这篇文章主要给大家介绍了关于CSS3中伪元素::before和::after的用法,需要的朋友可以参考学习。
这篇文章主要介绍了html5移动端价格输入键盘的实现,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
这篇文章主要介绍了CSS中的导航栏和下拉菜单的实现的相关资料,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧
这篇文章主要介绍了CSS3实现酷炫的3D旋转透视效果,代码简单易懂,非常不错,具有一定的参考借鉴价值,需要的朋友可以参考下
css兼容问题兼容问题1.文字本身的大小不兼容。同样是font-size:14px的宋体文字,在不同浏览器下占的空间是不一样的,ie下实际占高16px,下留白3px,ff下实际占高17px,上留白1px,下留白3px。解决方案:给文字设定line-height。确保所有文字都有默认的line-height值。2.ff下容器高度限定.即容器定义了height之后,容器边框的外形就确定了
成为群英会员,开启智能安全云计算之旅
立即注册Copyright © QY Network Company Ltd. All Rights Reserved. 2003-2020 群英 版权所有
增值电信经营许可证 : B1.B2-20140078 粤ICP备09006778号 域名注册商资质 粤 D3.1-20240008