07-CSS网页布局基础
第1章 基础布局(布局必备,多练习)
1-1 经典的行布局(1)
<!DOCTYPE html>
<html>
<head>
<title>3</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<style type="text/css">
body{
margin: 0;
padding: 0;
color: #fff;
text-align: center;
}
.header{
width: 1200px;
height: 100px;
background:black;
position: absolute;
top: 50%;
left: 50%;
margin-top: -50px;
margin-left: -600px;
overflow: hidden;
zoom:1;
}
.header .logo{
width: 200px;
height: 80px;
float: left;
margin: 0 40px;
}
ul{
list-style: none;
}
a{
text-decoration: none;
}
.header .nav{
float: right;
height: 80px;
margin-right: 40px;
overflow: hidden;
zoom:1;
}
.header .nav li{
float: left;
margin-right: 20px;
}
.header .nav li a{
padding: 0 20px;
height: 80px;
line-height: 80px;
display: block;
font-family: "微软雅黑";
font-size: 16px;
color: #fff;
}
.header .nav li a:hover{
color: #6F6;
}
</style>
</head>
<body>
<div class="header">
<div class="logo">
<a href="#"><img src="http://climg.mukewang.com/58c0d2d900016ce303000100.png"></a>
</div>
<ul class="nav">
<li><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>
</div>
</body>
</html>
1-2 经典的行布局(2)
1-3 经典的两列布局
1-4 经典的三列布局
1-5 混合布局
<!DOCTYPE html>
<html>
<head>
<title>3</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<style type="text/css">
body{
margin: 0;
padding: 0;
color: #fff;
}
.line1{
width: 90%;
margin: 0 auto;
height: 500px;
background-color: #9cf;
overflow: hidden;
zoom:1;
}
.lie1 img,.lie2 img{
width: 38%;
height: 400px;
float: left;
background-image: no-repeat top center;
margin-right: 8%;
margin-top: 50px;
}
.lie1 img{
margin-left: 8%;
}
.line2{
width: 90%;
margin: 0 auto;
height: 500px;
background-color: #FCC;
overflow: hidden;
zoom:1;
}
.one img,.two img,.three img{
width: 24%;
height: 400px;
float: left;
background-image: no-repeat top center;
margin-right: 7%;
margin-top: 50px;
}
.one img{
margin-left: 7%;
}
</style>
</head>
<body>
<div class="line1">
<div class="lie1"><img src="http://climg.mukewang.com/58c0f808000129a303600215.jpg"></div>
<div class="lie2"><img src="http://climg.mukewang.com/58c0f819000198a703600214.jpg"></div>
</div>
<div class="line2">
<div class="one"><img src="http://climg.mukewang.com/58c0f81d0001fe4402000060.jpg"></div>
<div class="two"><img src="http://climg.mukewang.com/58c0f8220001dfce02000060.jpg"></div>
<div class="three"><img src="http://climg.mukewang.com/58c0f8780001c74602000060.jpg"></div>
</div>
</body>
</html>