《HTML+CSS》视频11 简单布局、导航条

简单布局

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title>my first web</title>
		<style type="text/css">
			.head{
			width:1000px;
			height:120px;
			background-color:#efa;
			margin:0 auto;
			}
			.content{
			width:1000px;
			height:600px;
			background-color:#dbe;
			margin:10px auto;
			}
			.sports{
			width:200px;
			height:100%;
			background-color:skyblue;
			float:left;
			}
			.news{
			width:580px;
			height:100%;
			background-color:gold;
			margin:0 10px;
			float:left;
			}
			.ads{
			width:200px;
			height:100%;
			background-color:aquamarine;
			float:left;
			}
			.foot{
			width:1000px;
			height:120px;
			background-color:#4ca;
			margin:0 auto;
			}

		</style>

	<head>
	<body>
		<div class="head"></div>
		<div class="content">
			<div class="sports"></div>
			<div class="news"></div>
			<div class="ads"></div>
		</div>
		<div class="foot"></div>
	<body>
	
<html>

效果图:
在这里插入图片描述

导航条

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8"/>
		<title>header</title>
		<style type="text/css">
			*{
			margin:0;
			padding:0;
			}
			.nav{
			width:1000px;
			background-color:#15a5ff;
			margin:0 auto;
			margin-top:50px;
			/*
			放置高度塌陷
			*/
			overflow:auto;
			}
			.nav li{
			list-style:none;
			float:left;
			width:25%;
			
			}
			.nav li a{
			/*
			a标签是内联元素,不能设置宽度
			*/
			display:block;
			width:100%;
			text-decoration:none;
			font-weight:bold;
			color:white;
			text-align:center;
			padding:5px 0;
			
			}
			.nav li a:hover{
			background-color:red;
			}
		</style>
	</head>
	<body>
		<ul class="nav">
			<li><a href="#">姓名</a></li>
			<li><a href="#">性别</a></li>
			<li><a href="#">年龄</a></li>
			<li><a href="#">喜好</a></li>
			
		</ul>
	</body>
</html>

效果如下:
在这里插入图片描述

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值