导航栏html代码

效果如下

 html 代码

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title>导航制作</title>
		<link rel="stylesheet" href="css/style.css">
		<link rel="stylesheet" href="css/public.css">
	</head>
	<body>
		<!-- 导航 -->
		<nav class="pageNav">
			<ul class="list">
				<li><a href="#" target="_blank"><span>首页</span></a></li>
				<li><a href="#" target="_blank"><span>公司产品</span></a></li>
				<li><a href="#" target="_blank"><span>公司介绍</span></a></li>
				<li><a href="#" target="_blank"><span>联系我们</span></a></li>
				<li><a href="#" target="_blank"><span>招聘人才</span></a></li>
			</ul>
		</nav>
		<!-- 导航 end -->
	</body>
</html>

css 代码

.pageNav{
	height: auto;
	width:100%;
	margin-left: 0;
	background:#FF0000;
	position: fixed; 
	top: 0;
	margin-bottom: 5px;
	font-size: 15px;
	transform: skewX( 30deg);
	display: block; 
}
a{
	height: 40px;
	line-height: 40px;
	background-color:#f00;
	color: #fff;
	padding-left: 40px;
	padding-right: 40px;
	text-align: center;
	text-decoration: none;
	margin-left: auto;
	margin-right: auto;
	border-radius: 10px 0;
	}			
a:hover{
	background-color: #00aaff;
	}
li{
	list-style-type: none;
	float: left;
	display: block;
	position: inherit;
	margin-right: 20px;
	transform: skewX(-30deg); 
	}
.pageNav a{
	transition: all 0.5s;
}

公文样式

*{ 
	margin:0; padding:0;
}
ol,ul,li{ 
	list-style:none;
}
a{
	text-decoration: underline;
}

ins,a{ 
	text-decoration:none;
}
  • 14
    点赞
  • 115
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
HTML顶部导航代码是用来创建一个网页的页面顶部导航菜单的代码。顶部导航通常位于网页的顶部,用于为用户提供网站的主要导航链接。以下是一个简单的HTML顶部导航代码示例: ```html <!DOCTYPE html> <html> <head> <title>网页标题</title> <style> /* 样式可以通过CSS来定义 */ .topnav { background-color: #333; overflow: hidden; } .topnav a { float: left; color: #f2f2f2; text-align: center; padding: 14px 16px; text-decoration: none; } .topnav a:hover { background-color: #ddd; color: black; } .topnav a.active { background-color: #4CAF50; color: white; } </style> </head> <body> <div class="topnav"> <a class="active" href="#">首页</a> <a href="#">关于</a> <a href="#">服务</a> <a href="#">联系</a> </div> <!-- 其他页面内容 --> </body> </html> ``` 这段代码首先定义了一个包含顶部导航的div元素,并赋予其类名为"topnav"。然后,在样式部分使用CSS定义了顶部导航的样式,包括背景颜色、链接的浮动、颜色等等。链接的active类用于表示当前所在页面的链接。 在body部分,将顶部导航放置在一个div元素内,然后通过添加多个`<a>`元素来创建导航链接。 这段代码的效果是创建一个顶部导航,包含了"首页"、"关于"、"服务"和"联系"四个链接。当鼠标悬停在链接上时,链接的背景颜色会变为灰色,字体颜色变为黑色。当前所在页面的链接("首页")的背景颜色会变为绿色,字体颜色变为白色。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值