如何做一个简单的网页导航

如何运用html和css制作一个简单的网页导航

代码示例:

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<style type="text/css">
			.nav{
				/* 设置高和宽 */
				height: 90px;
				width: 530px;
				/* 背景颜色 */
				background-color: #909090;
				/* 左右自动居中 */
				margin-left: auto;
				margin-right: auto;
				/* 行内元素-行内块元素-文本居中 */
				text-align: center;
			}
			.nav a{
				/* 转换为块元素,为了设置宽高 */
				display: inline-block;
				/* 高 */
				width: 105px;
				/* 行高90 让文本垂直在90居中 */
				line-height: 90px;
				/* 文字大小,粗细 */
				font-size: 24px;
				font-weight: 800;
				/* 不要装饰线 */
				text-decoration: none;
				/* 白色 */
				color: white;
				/* 默认设置左边两像素和背景一致的边框 */
				border-left:1px solid #909090 ;
			}
			.nav a:hover{
				/* 鼠标放上去改变背景和边框颜色 */
				background-color: red;
				border-left-color:white ;
			}
		</style>
	</head>
	<body>
		<div class="nav">
			<a href="">首页</a>
			<a href="">活动</a>
			<a href="">帮助</a>
			<a href="">招聘</a>
		</div>
	</body>
</html>

效果示例:

在这里插入图片描述

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值