0
点赞
收藏
分享

微信扫一扫

2023年9月14日

效果图

图1

2023年9月14日_导航栏

图2

2023年9月14日_导航栏_02

浮动显示信息、导航栏

HTML

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title>2023年9月14日</title>
		<link rel="stylesheet" href="./css/index_style.css">
	</head>
	<body>
		<span>导航</span>
		<ul class="uc1">
			<li class="uc11">首页</li>
			<li>美食</li>
			<li>旅行</li>
			<li>健身</li>
			<li>学习</li>
		</ul>
		<span class="sc">美食分类
			<ul>
				<li>糖醋里脊</li>
				<li>地三鲜</li>
				<li>皮蛋豆腐</li>
			</ul>
		</span>
	</body>
</html>

CSS

ul.uc1{
	/* background-color: antiquewhite; */
	margin: 30px;
	list-style: none;
	overflow: hidden;
}
ul.uc1 > li{
	width: 200px;
	height: 30px;
	background-color: aqua;
	float: left;
	line-height: 30px;
	text-align: center;
}
ul.uc1 > li.uc11{
	color: white;
	background-color: blue;
}
ul.uc1 > li:hover{
	color: white;
	background-color: blue;
	/* 将鼠标的样式改为小手 */
	cursor: pointer;
}
*{
	margin: 0;
	padding: 0;
}



span.sc{
	background-color: blue;
	color: white;
	position: relative;
	padding: 10px;
	border-radius: 6px;
	margin: 20px;
	font-size: 18px;
}
span.sc:hover > ul{
	display: block;
}
span.sc > ul{
	display: none;
	list-style: none;
	max-width: 200px;
	min-width: 100px;
	background-color: black;
	color: white;
	position: absolute;
	left: 30px;
	top: 40px;
	border-radius: 10px;
	padding: 10px;
	font-family: '楷体';
	font-size: 16px;
}

仅供学习,参考使用,可一起交流,前进!前进!前进!

举报

相关推荐

0 条评论