HTML二级菜单

二级菜单

在这里插入图片描述

代码

<html>
<head>
	<title>二级菜单</title>
	<meta charset="utf-8">
	<style type="text/css">
		.news div{
			margin:50px;
			width: 40px;
		}
		.news div>a{
			margin-left: 30px;
			width:30px;
			height: 30px;
			content: url("news.png");
		}
		.news div>ul{
			width:90px;
			height: 192px;
			margin:0px 0px;
			position: absolute;
			display: none;
		}
		.news ul ,.new li{
			padding :0px 0px;
			margin: 0px 0px;
			list-style: none;
		}
		.news >div>ul>li>a{
			color:#3d3d3d;
			font-size: 12px;
			text-decoration:none;
			display: block;
		}
		.news >div>ul>li>a:hover{
			background-color:#f5f5f5;
			color:#ff9ee5;
		}
		.news >div>ul>li{
			width: 90px;
			height: 24px;
			text-align: center;
			line-height: 24px;
			background:#d9d9d9;
		}
		.news >div:hover ul{
			display: block;
		}
	</style>
</head>
<body>
	<div class="news">
		<div>
			<a href="#"></a>
			<ul>
				<li ><a href="#">公告</a></li>
				<li><a href="#">评论</a></li>
				<li><a href="#">关注</a></li>
				<li><a href="#">点赞</a></li>
				<li><a href="#">私信</a></li>
				<li><a href="#">回答</a></li>
				<li><a href="#">系统通知</a></li>
				<li><a href="#">消息设置</a></li>
			</ul>
		</div>
	</div>
</body>
</html>

效果

在这里插入图片描述

设置css样式<style type="text/css">

<a>标签的大小设置:
设置display:block;再设置width和height

设置鼠标停留在<a>标签上时的效果:
定义一个css 类选择器
.css a:hover{
background:#ff9ee5;
}

隐藏标签
display:none;

去掉li的样式
list-style:none;

外边距 margin
内边距 padding

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值