CSS3绘制气泡背景墙
CSS3绘制气泡背景墙
重要知识点:
position: absolute;
bottom: -200px;
绝对定位的bottom发生改变,使得呈现div框向上的效果
display: flex; 弹性布局
justify-content: center; 主轴居中对齐
align-items: center; 交叉轴居中对齐
animation-duration: 7s;
transition-duration:指定过渡效果的持续时间
时间单位:s 和 ms 1s=1000ms
可以分别指定时间(transition-duration: 100ms,2s;)
animation-delay: 2s; 设置动画的延时
transform: translateY(-400px) rotate(90deg);
translateY设置对象沿Y轴平移,表达式中的translation-value,是对象沿Y轴方向平移的数值,如 100px。
CSS3 2D 转换 - rotate 旋转 指的是 令 标签元素 在 二维坐标系中 , 顺时针 / 逆时针 旋转指定的度数 ;
transform: rotate(90deg);
旋转度数 : 旋转度数的单位是 deg , 表示度 ;
旋转方向 : 度数为整数 为 顺时针旋转 , 度数为负数 为 逆时针旋转 ;
旋转中心 : 默认的旋转中心点为 标签元素的中心点 ;

html:
<div class="bruce"> <ul class="bubble-bgwall"> <li>Love</li> <li>Love</li> <li>Love</li> <li>Love</li> <li>Love</li> <li>Love</li> <li>Love</li> <li>Love</li> <li>Love</li> <li>Love</li> </ul> </div>
css:
<style>
*{
margin:0;
padding:0;
}
.bruce{
/* 宽度设置为视口宽度的100% */
width: 100vw;
/* 高度设置为视口高度的100% */
height: 100vh;
background-image: linear-gradient(270deg,#8146b4,#6990f6);
}
.bubble-bgwall{
overflow: hidden;
position: relative;
margin: 0 auto;
width: 1200px;
height: 100%;
}
.bubble-bgwall li{
display: flex;
position: absolute;
bottom: -200px;
justify-content: center;
align-items: center;
border-radius: 10px;
width: 50px;
height: 50px;
padding:30px;
background-color: rgba(255,255,255,0.15);
opacity:0.15;
color: pink;
font-size: 30px;
animation: bubble 15s infinite;
}
.bubble-bgwall li:nth-child(1){
left: 10%;
}
.bubble-bgwall li:nth-child(2){
left: 20%;
width: 90px;
height: 90px;
animation-duration: 7s;
animation-delay: 2s;
}
.bubble-bgwall li:nth-child(3){
left: 25%;
animation-delay: 4s;
}
.bubble-bgwall li:nth-child(4){
left: 40%;
width: 60px;
height: 60px;
background-color: rgba(255,255,255,0.3);
animation-duration: 8s;
}
.bubble-bgwall li:nth-child(5){
left: 70%;
}
.bubble-bgwall li:nth-child(6){
left: 80%;
width: 120px;
height: 120px;
background-color: rgba(255,255,255,0.2);
animation-delay: 3s;
}
.bubble-bgwall li:nth-child(7){
left: 32%;
width: 160px;
height: 160px;
animation-delay: 2s;
}
.bubble-bgwall li:nth-child(8){
left: 55%;
width: 40px;
height: 40px;
font-size: 12px;
animation-duration: 15s;
animation-delay: 4s;
}
.bubble-bgwall li:nth-child(9){
left: 25%;
width: 40px;
height: 40px;
background-color: rgba(255,255,255,0.2);
font-size: 12px;
animation-duration: 12s;
animation-delay: 2s;
}
.bubble-bgwall li:nth-child(10){
left: 85%;
width: 160px;
height: 160px;
animation-delay: 5s;
}
@keyframes bubble{
0%{
opacity: 0.5;
transform: translateY(0) rotate(45deg);
}
25%{
opacity: 0.75;
transform: translateY(-400px) rotate(90deg);
}
50%{
opacity: 1;
transform: translateY(-600px) rotate(135deg);
}
100%{
opacity: 0;
transform: translateY(-1000px) rotate(180deg);
}
}
</style>
吐槽一下


还没有留言,还不快点抢沙发?