欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 汽车 > 时评 > CSS实现一张简易的贺卡

CSS实现一张简易的贺卡

2025/2/26 22:43:57 来源:https://blog.csdn.net/StarPlatinum2/article/details/145828819  浏览:    关键词:CSS实现一张简易的贺卡

效果


在这里插入图片描述
当你把鼠标移至贺卡上时,贺卡会缓慢打开。
在这里插入图片描述

代码如下


<!DOCTYPE html>
<html lang="zh-CN"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Document</title><style>* {margin: 0;padding: 0;box-sizing: border-box;}body {display: flex;justify-content: center;align-items: center;width: 100vw;height: 100vh;background: #2e3c50;}.card {width: 300px;height: 200px;display: flex;justify-content: center;align-items: center;background: gold;color: cornsilk;position: relative;transform-style: preserve-3d;transform: perspective(900px) rotateX(55deg);font-size: 2em;cursor: pointer;}.card::before, .card::after {width: 50%;height: 100%;position: absolute;background: #e11a52;top: 0;align-items: center;display: flex;box-sizing: border-box;transition: 2s;}.card::before {content: "新年";left: 0;justify-content: flex-end;border-right: 2px solid black;padding-right: 10px;transform-origin: left;}.card::after {content: "快乐";right: 0;border-left: 2px solid black;padding-left: 10px;transform-origin: right;}.card:hover::before {transform: rotateY(-180deg);    }.card:hover::after {transform: rotateY(180deg);}/* card background: gold; color: c* *//* card::before background: #e11a52; */</style>
</head><body><div class="card">JAVA</div>
</body></html>

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

热搜词