CSS3的新特性

CSS盒子模型

  • 怪异盒子
div {
width: 200px;
height: 200px;
background-color: pink;
border: 1px solid red;
/* border+padding+contter */
/* box-sizing: border-box; */
/* 怪异盒子 */
box-sizing: border-box;
/* 他的宽度就是width */
}
  • 前提是padding和boeder不会超过width

CSS滤镜的filter:burl(15px),width:calc(100%-30px)函数

CSS过渡(重点)

<!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>
<link rel="stylesheet" href="iconfont/demo.css">
<style>div {
width: 200px;
height: 100px;
background-color: pink;
border: 1px solid red;
/* transition: 要过渡的属性、花费的时间、运动曲线、何时开始; */
/* 谁想过渡就给谁加 */
/* 如果想让属性值都发生变化,只需要把ALL的值改为属性值 */
transition: width 1s, height .5s;
}
div:hover {
width: 400px;
height: 200px;
}</style>
</head>
<body>
<div>
</div>
</body>
</html>

进度条操作

<!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>
<link rel="stylesheet" href="iconfont/demo.css">
<style>.bar {
width: 150px;
height: 15px;
border: 1px solid red;
border-radius: 7px;
padding: 1px;
}
.bar_in {
width: 50%;
height: 100%;
background-color: red;
border-radius: 7px;
transition: width .5s;
}
.bar:hover .bar_in {
width: 100%;
}</style>
</head>
<body>
<div class="bar">
<div class="bar_in"></div>
</div>
</body>
</html>