1.1圆角边框
1.2盒子阴影
1.3文字阴影
CSS浮动
为什么需要浮动
什么是浮动
浮动的特性(重点)
1.6浮动元素经常和标准流父级搭配使用
手机案例
布局案例
手机商城案例
<style>
.box {
width: 1226px;
height: 615px;
background-color: pink;
margin: 0 auto;
}
.left {
float: left;
width: 234px;
height: 615px;
background-color: purple;
}
.right {
float: left;
width: 992px;
height: 615px;
background-color: skyblue;
}
.right>div {
/* 子代选择器 选择所有亲儿子 */
width: 234px;
height: 300px;
background-color: pink;
float: left;
margin-left: 14px;
margin-bottom: 14px;
/* padding-bottom: 14px; */
/* 设置左浮 具有行内块元素的特点 顺序靠左排 超过父亲宽度另起一行 */
}
</style>
</head>
<body>
<div class="box">
<div class="left">左边</div>
<div class="right">
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
<div>6</div>
<div>7</div>
<div>8</div>
</div>
</div>
</body>
2.常见网页布局
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
* {
padding: 0;
margin: 0;
}
li {
list-style: none;
}
.top {
/* 通栏 不设置宽度和浏览器一样宽 */
height: 50px;
background-color: gray;
}
.banner {
height: 150px;
width: 980px;
background-color: gray;
margin: 10px auto;
}
.box {
height: 300px;
width: 980px;
margin: 0 auto;
background-color: pink;
}
.box li {
width: 237px;
height: 300px;
background-color: gray;
float: left;
margin-right: 10px;
}
/* 别忘了权重问题 给最后的盒子指定margin */
.box .last {
margin-right: 0;
}
/* 只要是通栏的盒子(和浏览器一样宽)不需要指定宽度 */
.footer {
background-color: gray;
height: 200px;
margin-top: 10px;
}
</style>
</head>
<body>
<div class="top">top</div>
<div class="banner">banner</div>
<div class="box">
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
<li class="last">4</li>
</ul>
</div>
<div class="footer">footer</div>
</body>
</html>
2.2浮动布局注意点
3.1为什么需要清除浮动
3.2清除浮动本质
3.3清除浮动语法
3.3.1额外标签法
3.3.2
3.3.3alter伪元素法
3.3.3双伪元素清除浮动
.clearfix:before,
.clearfix:after {
content: "";
display: table;
}
.clearfix:after {
clear: both;
}
.clearfix {
*zoom: 1;
}