当前位置:网站首页>【无标题】
【无标题】
2022-08-04 11:15:00 【JackieDYH】
七夕来袭!是时候展现专属于程序员的浪漫了!你打算怎么给心爱的人表达爱意?鲜花礼物?代码表白?还是创意DIY?或者…无论那种形式,快来秀我们一脸吧!
效果
html代码
<div class="valentines-day">
<div class="envelope"></div>
<div class="heart"></div>
<div class="text">HAPPY 520 DAY!</div>
<div class="front"></div>
<div class="text2">- hover over the envelope - </div>
</div>
css代码
body {
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
background-color: #f1e3d3;
overflow: hidden;
}
.valentines-day {
position: relative;
cursor: pointer;
}
.envelope {
position: relative;
filter: drop-shadow(0 0 25px rgba(0,0,0,.3));
}
.envelope:before {
content:"";
position: absolute;
width:254px;
height:254px;
background-color: #ff9494;
transform: rotate(-45deg);
border-radius: 0 15px 0 0;
left:-37px;
top:-82px;
}
.envelope:after {
content:"";
position: absolute;
background-color: #ff9494;
width:360px;
height:225px;
left:-90px;
top:45px;
}
.heart {
position: relative;
background-color: #e01911;
display: inline-block;
height: 180px;
top:50px;
left:0;
transform: rotate(-45deg);
width:180px;
filter: drop-shadow(0 -10px 25px rgba(0,0,0,.3));
transition: .5s;
}
.heart:before, .heart:after {
content:"";
background-color: #e01911;
border-radius:50%;
height: 180px;
width: 180px;
position: absolute;
}
.heart:before {
top:-100px;
left:0;}
.heart:after {
left:100px;
top:0;}
.front {
position: absolute;
width:0;
height:0;
border-right: 190px solid #fbd2d2;
border-top: 113px solid transparent;
border-bottom: 113px solid transparent;
top:44px;
left:80px;
z-index:4;
}
.front:before {
content:"";
position: absolute;
width:0;
height:0;
border-left: 190px solid #fbd2d2;
border-top: 113px solid transparent;
border-bottom: 113px solid transparent;
top:-113px;
left:-170px;
}
.front:after {
width:0;
height:0;
position: absolute;
content:"";
border-bottom: 150px solid #fce7e9;
border-right:180px solid transparent;
border-left: 180px solid transparent;
top:-36px;
left:-170px;
}
.text {
position: absolute;
font-family: arial;
letter-spacing:5px;
text-align: center;
color: white;
z-index:2;
top:80px;
left:15px;
transition: .5s;
}
.valentines-day:hover .heart {
transform: translateY(-50px) rotate(-45deg);
}
.valentines-day:hover .text {
transform: translateY(-50px);
}
.text2 {
position: absolute;
top:275px;
color: white;
font-family: brush script mt;
text-align: center;
width:195px;
font-size:20px;
}
效果
html代码
<h2>Have Dinner with Me<br/> On Friday?</h2>
<div id="heart">
</div>
<div class="glass-wrapper">
<div class="top">
<div class="liquid">
<div class="shadow">
</div>
</div>
<div class="shadow2"></div>
</div>
<div class="stand"></div>
<div class="bottom"></div>
<div class="heart h1"></div>
<div class="heart h2"></div>
<div class="heart h3"></div>
<div class="heart h4"></div>
<div class="heart h5"></div>
<div class="heart h6"></div>
</div>
css代码
body {
background-color: #fe9cd1;
font-family: 'Dancing Script', cursive; }
h2 {
text-align: center;
margin-top: 40px;
font-size: 50px;
color: #333; }
#heart {
position: absolute;
left: calc(50% - 200px);
top: calc(50% - 180px);
width: 400px;
height: 360px;
opacity: 0.2; }
#heart:before,
#heart:after {
position: absolute;
content: "";
left: 200px;
top: 0;
width: 200px;
height: 360px;
background: red;
-moz-border-radius: 100px 1000px 0 0;
border-radius: 100px 100px 0 0;
-webkit-transform: rotate(-45deg);
-moz-transform: rotate(-45deg);
-ms-transform: rotate(-45deg);
-o-transform: rotate(-45deg);
transform: rotate(-45deg);
-webkit-transform-origin: 0 100%;
-moz-transform-origin: 0 100%;
-ms-transform-origin: 0 100%;
-o-transform-origin: 0 100%;
transform-origin: 0 100%; }
#heart:after {
left: 0;
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
-ms-transform: rotate(45deg);
-o-transform: rotate(45deg);
transform: rotate(45deg);
-webkit-transform-origin: 100% 100%;
-moz-transform-origin: 100% 100%;
-ms-transform-origin: 100% 100%;
-o-transform-origin: 100% 100%;
transform-origin: 100% 100%; }
.glass-wrapper {
position: absolute;
left: calc(50% - 150px);
top: calc(50% - 230px);
width: 300px;
height: 500px;
cursor: pointer; }
.glass-wrapper:hover {
animation: shake 1.3s ease; }
.top {
position: absolute;
left: 70px;
top: 80px;
width: 150px;
height: 250px;
overflow: hidden;
border: 5px solid #333;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
border-bottom-left-radius: 60%;
border-bottom-right-radius: 60%;
z-index: 2; }
.top .liquid {
position: absolute;
bottom: 0;
width: 150px;
height: 150px;
background-color: #c0392b; }
.top .liquid .shadow {
position: absolute;
bottom: -100px;
right: -100px;
width: 300px;
height: 300px;
background-color: transparent;
border-bottom-left-radius: 50%;
border-bottom-right-radius: 50%;
border: 100px solid rgba(0, 0, 0, 0.2); }
.top .shadow2 {
position: absolute;
left: 20px;
top: 10px;
width: 10px;
height: 160px;
background-color: rgba(255, 255, 255, 0.3);
border-bottom-left-radius: 100%; }
.stand {
position: absolute;
left: 142px;
top: 338px;
width: 5px;
height: 100px;
border: 5px solid #333;
border-top-width: 2px;
border-bottom: 0;
background-color: rgba(255, 255, 255, 0.3); }
.bottom {
position: absolute;
left: 90px;
top: 438px;
width: 110px;
height: 5px;
border: 5px solid #333;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
background-color: rgba(255, 255, 255, 0.3); }
.heart {
position: absolute;
width: 100px;
height: 90px;
top: 200px; }
.heart.h1 {
left: 120px;
animation: transition-up 5s ease-in-out 1s infinite; }
.heart.h2 {
left: 150px;
animation: transition-up 5s ease-in-out infinite; }
.heart.h3 {
animation: transition-up 5s ease-in-out 2s infinite;
left: 90px; }
.heart.h4 {
animation: transition-up 5s ease-in-out 3s infinite;
left: 115px; }
.heart.h5 {
animation: transition-up 5s ease-in-out 4s infinite;
left: 135px; }
.heart.h6 {
animation: transition-up 5s ease-in-out 3.5s infinite;
left: 140px; }
.heart:before, .heart:after {
position: absolute;
content: "";
left: 25px;
top: 0;
width: 25px;
height: 40px;
background: #c0392b;
-moz-border-radius: 50px 50px 0 0;
border-radius: 50px 50px 0 0;
-webkit-transform: rotate(-45deg);
-moz-transform: rotate(-45deg);
-ms-transform: rotate(-45deg);
-o-transform: rotate(-45deg);
transform: rotate(-45deg);
-webkit-transform-origin: 0 100%;
-moz-transform-origin: 0 100%;
-ms-transform-origin: 0 100%;
-o-transform-origin: 0 100%;
transform-origin: 0 100%; }
.heart:after {
left: 0;
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
-ms-transform: rotate(45deg);
-o-transform: rotate(45deg);
transform: rotate(45deg);
-webkit-transform-origin: 100% 100%;
-moz-transform-origin: 100% 100%;
-ms-transform-origin: 100% 100%;
-o-transform-origin: 100% 100%;
transform-origin: 100% 100%; }
@keyframes transition-up {
0% {
transform: translate3d(20px, 0, 0); }
20% {
transform: translate3d(-20px, 0, 0); }
40% {
transform: translate3d(20px, 0, 0); }
60% {
opacity: 1;
transform: translate3d(-20px, 0, 0); }
80% {
transform: translate3d(10px, 0, 0); }
100% {
opacity: 0;
top: 10px;
transform: translate3d(-10px, 0, 0); } }
@keyframes shake {
0% {
transform: rotate(0); }
25% {
transform: rotate(10deg); }
50% {
transform: rotate(-10deg); }
75% {
transform: rotate(5deg); }
100% {
transform: rotate(0deg); } }
/*# sourceMappingURL=index.css.map */
边栏推荐
- cat /proc/kallsyms found that the kernel symbol table values are all 0
- cubemx stm32 afm3000模块 气体流量传感器 驱动代码
- 少即是多:视觉SLAM的点稀疏化(IROS 2022)
- 手搓一个“七夕限定”,用3D Engine 5分钟实现烟花绽放效果
- 复盘:经典的HR面试问题,这些问题可以挖掘你个人的素质,看看你是否合适合我们部门
- vector中函数emplace_back的实现原理
- Jenkins使用手册(1) —— 软件安装
- *W3C* 标准组织
- 怎么禁止textarea拉伸
- 第二批养老理财试点产品发行 一小时销售20亿元
猜你喜欢
深度强化学习与APS的一些感想
audio_policy_configuration.xml配置文件详解
The use of DDR3 (Naive) in Xilinx VIVADO (2) Read and write design
剑指长城炮? 长安全新皮卡官方谍照
解析treeSet集合进行自定义类的排序
Leetcode brush questions - binary search tree related topics (98. Verify binary search tree, 235. The nearest common ancestor of binary search tree, 1038. From binary search tree to bigger sum tree, 5
Leetcode——利用先序遍历特性完成114. 二叉树展开为链表
C language * Xiaobai's adventure
第二批养老理财试点产品发行 一小时销售20亿元
ROI LTV CPA ECPM体系讲解
随机推荐
小程序实战(三) - head组件的封装与使用
CVPR 2022 | 从人体网格预测骨架,是真正的生理学骨架!
ArrayList和LinkedList的区别
手搓一个“七夕限定”,用3D Engine 5分钟实现烟花绽放效果
ORA-00054 资源正忙
Small program containers accelerate the construction of an integrated online government service platform
【励志】复盘的重要性
入门MySql表的增删查改
学会使用set和map的基本接口
Zikko launches new Thunderbolt 4 docking station with both HDMI2.1 and 2.5GbE
Leetcode刷题——543. 二叉树的直径、617. 合并二叉树(递归解决)
从零开始Blazor Server(7)--使用Furion权限验证
Business collocations
将博客搬至CSDN
临床研究方法学,到现场,到数据真实发生的地方 | 对话数智 x 张维拓
123
AWS Lambda相关概念与实现思路
The use of DDR3 (Naive) in Xilinx VIVADO (1) to create an IP core
datax oracle to oracle离线json文件
字节技术官亲码算法面试进阶神技太香了