项目实战-PC端固定布局【1】之完成导航

完成导航效果:


index.html:

<!DOCTYPE html>
<html lang="zh-cn">
<head>
	<title>项目实战-PC端固定布局(1)</title>
	<meta charset="utf-8">
	<link rel="stylesheet" type="text/css" href="css/style.css">
</head>
<body>


<nav id="nav">
	<section class="center">
		<h1 class="logo">星月旅行社</h1>
			<ul class="link">
				<li class="active"><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>
	</section>
</nav>

<header>header</header>

<section>section</section>

<footer >footer</footer>
</body>
</html>

style.css:

@charset "utf-8";
/*内外边距都是0*/
body,h1,ul{
	margin: 0;
	padding: 0;
}
/*将ul前面的点去掉*/
ul{
	list-style: outside none none;
}
/*将链接的下划线去掉*/
a{
	text-decoration: none;
}
/*#333是黑色*/
#nav{
	width: 100%;
	height: 70px;
	background-color: #333;
}
#nav .center{
	width: 1263px;
	height: 70px;
	margin: 0 auto;

}
/*将文本移走用到text-indent并插入logo*/
#nav .logo{
	width: 240px;
	height: 70px;
	background-image: url(../img/4.png);
	text-indent: -9999px;
	float:left;
}
/*#eee是灰色  line-height设置垂直居中*/
#nav .link{
	width: 650px;
	color:#eee;
	float: right;
	height: 70px;
	line-height: 70px;
}
/*水平居中*/
#nav .link li{
	float: left;
	width:120px;
	text-align: center;

}
/*将a由内联设置成块*/
#nav .link a{
	color:#eee;
	display: block;
}
/*鼠标效果*/
#nav .link a:hover,
#nav .active a{
background-color: #aaa;
}




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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值