分类:
前端
上代码!上代码!不说了
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> <link rel="stylesheet" href="mystyle.css"> </head> <body> <div class="content"> <div></div> <div></div> <div></div> <div><p>Hello!I hope you like it!</p><p>Thank you very much!</p></div> </div> </body> </html>
css:
body{
margin: 0;
padding: 0;
/* 基本上扑满 */
height: 100vh;
width: 100%;
/*
盒子模型
上下左右居中
*/
display: flex;
align-items: center;
justify-content: center;
}
.content{
/*
相对定位
*/
position: relative;
height: 640px;
width: 360px;
margin-top: 150px;
/* 通过颜色透明 */
background-color: rgba(0,0,0,.2);
transition: 0.5s;
/* 2D旋转 3D旋转 大小为自身的0.8 .8 == 0.8 */
transform: rotate(-30deg) skew(25deg) scale(.8);
}
.content div{
background-color: black;
/*
相对于父级的相对定位 进行绝对定位
*/
position: absolute;
width: 100%;
height: 100%;
color: white;
/* 左右居中 */
/* text-align: center; */
/* 上下居中 */
/* line-height: 640px; */
/* 过滤动画 */
transition: 1s;
}
p{
display: inline-block;
width: 100%;
font-size: 16px;
transform: translate(50px,50px);
}
.content:hover div:nth-child(4){
/* 基于上一次相对定位作出改变 */
transform: translate(160px,-160px);
/* 加粗 */
font-weight: bold;
/* 透明度 */
opacity: 1;
/* 投影方式 X轴偏移量 Y轴偏移量 阴影模糊半径 阴影扩展半径 阴影颜色; */
box-shadow: -10px 10px 20px 5px red;
}
.content:hover div:nth-child(3){
transform: translate(120px,-120px);
opacity: 0.8;
}
.content:hover div:nth-child(2){
transform: translate(80px,-80px);
opacity: 0.6;
}
.content:hover div:nth-child(1){
transform: translate(40px,-40px);
opacity: 0.4;
}用其工,迂回其力!
欢迎加群讨论技术,1群:677373950(满了,可以加,但通过不了),2群:656732739
评价
排名
6
文章
6
粉丝
16
评论
8
{{item.articleTitle}}
{{item.blogName}} : {{item.content}}
ICP备案 :渝ICP备18016597号-1
网站信息:2018-2025TNBLOG.NET
技术交流:群号656732739
联系我们:contact@tnblog.net
公网安备:
50010702506256
50010702506256
欢迎加群交流技术