【CSS】浪漫信封

简介: 【CSS】浪漫信封

效果

源码

 
<!DOCTYPE html>
<html>
 
<head>
    <meta charset="UTF-8">
    <!-- 导入字体 -->
    <link href="https://fonts.googleapis.com/css?family=Lato:300|Sacramento" rel="stylesheet">
    <title></title>
    <style>
        body {
            height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
            background-color: #f2acac;
        }
 
        input#open {
            display: none;
        }
 
        .card {
            position: relative;
            width: 300px;
            height: 300px;
            transform-style: preserve-3d;
            transform: perspective(2500px);
            transition: .3s;
        }
 
        .card-front {
            position: relative;
            background-color: #fff0f3;
            width: 300px;
            height: 300px;
            transform-origin: left;
            box-shadow: 30px 0 50px rgba(0, 0, 0, 0.3);
            transition: .3s;
        }
 
        .card-front:before {
            content: "";
            position: absolute;
            width: 280px;
            height: 280px;
            background-color: #f38e8e;
            top: 10px;
            left: 10px;
        }
 
        .card-inside {
            position: absolute;
            background-color: #fff0f3;
            width: 300px;
            height: 300px;
            z-index: -1;
            left: 0;
            top: 0;
            background-color: #f5f5f5;
        }
 
        .open {
            position: absolute;
            width: 300px;
            height: 300px;
            left: 0;
            top: 0;
            background-color: transparent;
            z-index: 6;
            cursor: pointer;
        }
 
        #open:checked~.card-front {
            transform: rotateY(-145deg);
        }
 
        #open:checked~.card-front:before {
            z-index: 5;
            background-color: #fff0f3;
            width: 330px;
            height: 300px;
            top: 0;
            left: 0;
            background-image: url(./img/love.gif);
            background-size: cover;
            transform: rotateY(155deg) translateX(16px);
        }
 
        .note {
            position: relative;
            width: 200px;
            height: 150px;
            background-color: #fff0f3;
            top: 85px;
            left: 50px;
            color: #333;
            font: 900 35px '';
            display: flex;
            align-items: center;
            text-align: center;
            filter: drop-shadow(0 0 20px rgba(0, 0, 0, 0.3));
        }
 
        img {
            position: absolute;
            width: 90px;
            left: 50%;
            transform: translateX(-50%);
            z-index: 2;
            top: 25px;
        }
 
        .text-one {
            position: absolute;
            color: #333;
            font-size: 15px;
            top: 30px;
            width: 300px;
            text-align: center;
            color: #ff9999;
            font-family: 'Sacramento';
        }
 
        .text-one:after {
            content: "";
            top: 80px;
        }
    </style>
</head>
 
<body>
    <div class="card">
        <input id="open" type="checkbox">
        <label class="open" for="open"></label>
        <div class="card-front">
            <img src="./img/love.png" alt="" class="love">
            <div class="note">Open it! 💗💗💗 </div>
        </div>
        <div class="card-inside">
            <div class="text-one">
                <h1>💌520💌</h1>
                <h2>
                    Your eyes are really beautiful, there are rain, sun and moon, mountains,
                    rivers, clouds, flowers and birds,
                    but my eyes are better, because I have you in my eyes.
                </h2>
            </div>
        </div>
    </div>
</body>
 
</html>

素材

                            love.gif                                                              love.png

相关文章
|
前端开发
前端|CSS信封的制作方法
前端|CSS信封的制作方法
231 0
|
前端开发
让我们用css去写一个表白信封
让我们用css去写一个表白信封
让我们用css去写一个表白信封
|
前端开发
css实现的信封
css实现的信封
86 0
|
前端开发
使用CSS来实现爱心信封的效果
使用CSS来实现爱心信封的效果
103 0
|
2月前
|
前端开发
2s 利用 HTML+css动画实现企业官网效果
2s 利用 HTML+css动画实现企业官网效果
HTML+CSS 实现通用的企业官网页面(记得收藏)
HTML+CSS 实现通用的企业官网页面(记得收藏)
|
5天前
|
前端开发 数据安全/隐私保护 容器
HTML+CSS 水滴登录页
该代码实现了一个创意的水滴登录页面,包含一个水滴形状的登录框与两个按钮(忘记密码和注册)。登录框包括用户名、密码输入框及登录按钮。页面设计独特,采用渐变色与动态效果,增强了交互性和视觉美感。以下为关键实现步骤: - 重置默认样式。 - 设置页面背景颜色和尺寸。 - 定义登录表单容器的布局、位置和尺寸。 - 设置登录表单内容样式,包括3D效果和过渡动画。 - 创建伪元素增强水滴效果。 - 设定输入框容器和输入框样式。 - 为提交按钮、忘记密码和注册按钮设定特定样式,并添加悬停效果。
|
23天前
|
Web App开发 前端开发 JavaScript
HTML/CSS/JS学习笔记 Day3(HTML--网页标签 下)
HTML/CSS/JS学习笔记 Day3(HTML--网页标签 下)
|
2月前
|
前端开发 JavaScript
HTML+CSS如何打造撒花动画效果?3分钟学会,炫酷到爆!
HTML+CSS如何打造撒花动画效果?3分钟学会,炫酷到爆!
|
2月前
|
前端开发 JavaScript
HTML+CSS助你轻松打造惊艳登录页,零基础也能学会!
HTML+CSS助你轻松打造惊艳登录页,零基础也能学会!