filter:函数()
<title>Document</title>
<style>
img{
filter: blur(5px);
}
img:hover{
filter: blur(0);
}
</style>
</head>
<body>
<!-- filter csss属性将模糊或颜色便宜等图形效果应用于元素 -->
<!-- filter:函数() filter:blur(5px);blur模糊处理 数值越大越模糊 -->
<img src=".././imgs/bg.gif" alt="">
</body>
</html>
2. calc() 函数
<!-- css3 cal函数 -->
<!-- calc()此css函数让你在声明css属性值执行一些计算 -->
<!-- 括号里面可以使用+-*/来进行计算 -->
<style>
.father{
width: 300px;
height: 200px;
background-color: pink;
}
.son{
width: calc(250 - 30px);
height: 30px;
background-color: skyblue;
}
</style>
</head>
<body>
<div class="father">
<div class="son"></div>
</div>
</body>
</html>
3.transition过渡
<title>Document</title>
<style>
<!-- 过渡动画:是从一个状态渐渐的过渡到另一个状态,经常和:hover一起用 -->
<!-- transition:要过渡的属性 花费时间 运动曲线 何时开始 -->
div{
width: 200px;
height: 100px;
background-color: pink;
/* transition: width .5s ease 1s; */
/* transition: height .5s ease 1s; 没变化 */
/* 如果想要写多个属性,利用逗号隔开 */
transition:width .5s,height .5s ;
/* 如果想要多个属性都变化,属性写all就可以了 */
/* 谁做过渡给谁加 */
transition: all .5s;
}
div:hover{
width: 400px;
height: 500px;
background-color: lawngreen;
}
</style>
</head>
<body>
<div></div>
</body>
</html>
案列:transition 进度条
<title>Document</title>
<style>
.bar{
width: 150px;
height: 15px;
border: 1px solid red;
border-radius:7px ;
padding: 1px;
transition: all 10s;
}
.bar_in{
width: 50%;
height: 100%;
background-color: red;
}
.bar:hover .bar_in{
width: 100%;
}
</style>
</head>
<body>
<div class="bar">
<div class="bar_in"></div>
</div>
</body>
</html>
4. transform: translate()位移
<title>Document</title>
<style>
<!-- 实现元素的位移,旋转,缩放等效果 -->
<!-- 移动 translate 旋转 rotate 缩放 scalse -->
<!-- 移动盒子的位置:定位 盒子的外边距 2d的转换移动 -->
div{
width: 200px;
height: 200px;
background-color: pink;
/* x就是x轴上移动位置,y轴就是y轴上移动位置,中间用逗号隔开 */
transform: translate(x,y);
transform: translate(100px,100px);
/* 只移动x轴 */
transform: translate(100px);
}
</style>
</head>
<body>
<div></div>
</body>
</html>
案列:让盒子水平居中
<title>Document</title>
<style>
div{
position: relative;
width: 400px;
height: 400px;
/* 我们tansform里面的参数可以用%
如果里面的参数据哦%移动的距离是盒子自身的宽度或则高度来对比的
这里的50%就是50px,因为盒子的宽度是100px */
background-color: pink;
/* transform: translateX(50%); */
}
p{
position: absolute;
top:50%;
left: 50%;
width: 200px;
height: 200px;</