Web前端第二次作业

作业要求:制作带有下拉悬停菜单的导航栏

html 复制代码
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<style>
			body{
				height: 1000px;
			}
			*{
				margin: 0;
				padding: 0;
			}
			#menu{
				background-color: #0c2374;
				width: 100%;
				height: 50px;
			}
			#container{
				background-color: #0c2374;
				width: 100%;
				height: 50px;
				
			}
			.item{
				/* 浮动属性可以让块标签,处在同一行 */
				float: left;
				width: 100px;
				height: 50px;
				line-height: 50px;
				text-align: center;
				position: relative;
				color: white;
			}
			.item:hover{
				background-color: steelblue;
			}
			#container{
				width: 800px;
				margin: auto;
			}
			.down_meun>div{
				color: white;
				
			}
			.down_meun{
				background-color: steelblue;
				display: none;
				position: absolute;
				
			}
			.item:hover>.down_meun{
				display: block;
				width: 100px;
			}
			
			#ding{
				width: 90px;
				height: 50px;
				border: 2px solid #0c2374;
				text-align: center;
				line-height: 50px;
				position: fixed;
				right: 0px;
				bottom: 0px;
				color: steelblue;
				
				
				border-radius: 30px;
				font-size: 1.25rem;
				line-height: 50px;
				text-align: center;
				color: #64c09B;
				font-weight: bolder;
			}
			#ding:hover{
				background-color: #64c09B;
				color: aliceblue;
				text-shadow: 7px 4px 2px seagreen;
				box-shadow: 5px 5px 1px green;
				transition: 2s;
			}
			
		</style>
	</head>
	<body>
			<div id="menu">
				<div id="container">
					<div class="item">游戏1
						<div class="down_meun">
							<div>游戏下载</div>
							<div>游戏交易</div>
							<div>游戏外挂</div>
							<div>游戏攻略</div>	
						</div>
						
					</div>
					<div class="item">游戏2
						<div class="down_meun">
							<div>游戏mod1</div>
							<div>游戏mod2</div>
							<div>游戏mod3</div>
							<div>游戏mod4</div>
							
						</div>
					</div>
					
					<div class="item">游戏3</div>
					<div class="item">游戏4
						<div class="down_meun">
							<div>商学院</div>
							<div>土木与工程</div>
							<div>艺术与传媒</div>
							<div>信息工程学院</div>
							<div>文理学院</div>
							<div>大数据与人工智能</div>
							<div>马克思主义</div>
							
							
						</div>
					</div>
					<div class="item">游戏5</div>
					<div class="item">游戏6</div>
					<div class="item">游戏7</div>
					<div class="item">游戏8</div>
				</div>
			<div id="ding">
				<a href="#menu" >
					回到顶部
				</a>
			</div>
			
		</body>
	</html>

页面结果:

相关推荐
Mintopia6 分钟前
3D Quickhull 算法:用可见性与冲突图搭建空间凸壳
前端·javascript·计算机图形学
Mintopia6 分钟前
Three.js 三维数据交互与高并发优化:从点云到地图的底层修炼
前端·javascript·three.js
陌小路12 分钟前
5天 Vibe Coding 出一个在线音乐分享空间应用是什么体验
前端·aigc·vibecoding
成长ing1213820 分钟前
cocos creator 3.x shader 流光
前端·cocos creator
Alo36528 分钟前
antd 组件部分API使用方法
前端
BillKu31 分钟前
Vue3数组去重方法总结
前端·javascript·vue.js
GDAL33 分钟前
Object.freeze() 深度解析:不可变性的实现与实战指南
javascript·freeze
江城开朗的豌豆1 小时前
Vue+JSX真香现场:告别模板语法,解锁新姿势!
前端·javascript·vue.js
这里有鱼汤1 小时前
首个支持A股的AI多智能体金融系统,来了
前端·python
袁煦丞1 小时前
5分钟搭建高颜值后台!SoybeanAdmin:cpolar内网穿透实验室第648个成功挑战
前端·程序员·远程工作