html_css_demo/css/87.css

120 lines
2.9 KiB
CSS
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/* 引入网络字体Poppins */
@import url("http://fonts.googleapis.com/css?family=Poppins:200,300,400,500,600,700,800,900&display=swap");
*{
/* 初始化 */
margin: 0;
padding: 0;
box-sizing: border-box;
/* 设置字体 */
font-family: "Poppins";
}
body{
/* 100%窗口高度 */
min-height: 100vh;
/* 弹性布局 水平+垂直居中 */
display: flex;
justify-content: center;
align-items: center;
background-color: #161626;
}
/* 给背景增加两个渐变圆 */
body::before{
content: "";
/* 绝对定位 */
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
/* 渐变背景 */
background: linear-gradient(#2193b0,#6dd5ed);
/* 将元素剪切微一个圆形【30%表示圆的直径】【right 70%表示圆心位置】 */
clip-path: circle(30% at right 70%);
}
body::after{
content: "";
/* 绝对定位 */
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
/* 渐变背景 */
background: linear-gradient(#ee9ca7,#ffdde1);
/* 将元素剪切微一个圆形【30%表示圆的直径】【right 70%表示圆心位置】 */
clip-path: circle(20% at 10% 10%);
}
.container{
position: relative;
display: flex;
justify-content: center;
align-items: center;
flex-wrap: wrap;
z-index: 1;
}
.container .card{
/* 相对定位 */
position: relative;
width: 280px;
height: 400px;
background-color: rgba(255,255,255,0.1);
margin: 30px;
border-radius: 15px;
/* 阴影 */
box-shadow: 20px 20px 50px rgba(0,0,0,0.5);
/* 溢出隐藏 */
overflow: hidden;
display: flex;
justify-content: center;
align-items: center;
border-top: 1px solid rgba(255,255,255,0.5);
border-left: 1px solid rgba(255,255,255,0.5);
/* 背景模糊 */
backdrop-filter: blur(5px);
}
.container .card .content{
padding: 20px;
text-align: center;
/* 默认下移+隐藏 */
transform: translateY(100px);
opacity: 0;
transition: 0.5s;
}
.container .card:hover .content{
/* 鼠标移入,上移+显示 */
transform: translateY(0);
opacity: 1;
}
.container .card .content h2{
position: absolute;
top: -80px;
right: 25px;
font-size: 128px;
color: rgba(255,255,255,0.05);
}
.container .card .content h3{
font-size: 28px;
color: #fff;
}
.container .card .content p{
font-size: 16px;
color: #fff;
font-weight: 300;
margin: 10px 0 15px 0;
}
.container .card .content a{
position: relative;
display: inline-block;
padding: 8px 20px;
margin-top: 15px;
background-color: #fff;
color: #000;
text-decoration: none;
border-radius: 20px;
font-weight: 500;
box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}
/* 这里要让玻璃效果更加逼真需要用到一个JS库vanilla-tilt.js */
/* 我事先下载好了需要这个JS库的可以找我拿 */
/* 看操作~ */