当前位置:网站首页>【每日一练】产品卡片动画效果的实现
【每日一练】产品卡片动画效果的实现
2022-06-27 07:56:00 【Phil Arist】
以下这个小项目依然是一个产品卡片的效果,具体效果如下:
HTML代码如下:
<!DOCTYPE html>
<html>
<head>
<title>【每日一练】CSS产品卡片动画效果的实现</title>
</head>
<body>
<div class="card">
<div class="cover">
<img src="watch1.png">
</div>
<div class="details">
<div>
<img src="watch2.png">
<h3>苹果电话手表</h3>
<h2>¥ 1999</h2>
<a href="https://www.webqdkf.com/" target="_blank">添加购物车</a>
</div>
</div>
</div>
</body>
</html>
CSS代码:
*
{
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Poppins', sans-serif;
}
body
{
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background: #09383e;
}
.card
{
position: relative;
margin: 20px 0;
width: 300px;
height: 400px;
background: #fff;
transform-style: preserve-3d;
transform: perspective(2000px);
box-shadow: inset 300px 0 50px rgba(0,0,0,.15),
0 20px 20px rgba(0,0,0,.15);
transition: 1s;
}
.card:hover
{
transform: perspective(2000px) translateX(50%);
box-shadow: inset 20px 0 50px rgba(0,0,0,.15), 0 10px 100px rgba(0,0,0,.15);
}
.card .cover
{
position: relative;
width: 100%;
height: 100%;
transform-origin: left;
z-index: 2;
transition: 1s ease-out;
background: #fff;
display: flex;
justify-content: center;
align-items: center;
transform-style: preserve-3d;
overflow: hidden;
}
.card .cover img
{
max-width: 100%;
z-index: 1;
}
.card:hover .cover
{
transform: rotateY(-180deg);
}
.card .cover::before
{
content: '';
position: absolute;
width: 10px;
background: #fff;
height: 150%;
transform: rotate(36.5deg);
box-shadow: 0 0 0 20px #47bfce;
transition: 0.5s;
transition-delay: 1s;
}
.card:hover .cover::before
{
width: 0px;
box-shadow: 0 0 0 250px #47bfce;
transform: rotate(143.5deg);
}
.card .details
{
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
padding: 20px;
display: flex;
justify-content: center;
align-items: center;
text-align: center;
overflow: hidden;
}
.card .details h3
{
font-weight: 500;
margin: 5px 0;
}
.card .details h2
{
font-size: 1.5em;
color: #e82a5b;
font-weight: 600;
}
.card .details a
{
display: inline-block;
padding: 8px 20px;
margin-top: 5px;
background: #47bfce;
color: #fff;
font-weight: 500;
letter-spacing: 1px;
border-radius: 25px;
text-decoration: none;
}
边栏推荐
- js用while循环计算假如投资多年的利率为5%,试求从1000块增长到5000块,需要花费多少年
- What are the specialties of database system engineers?
- 05 observer mode
- 语音信号处理-概念(一):时谱图(横轴:时间;纵轴:幅值)、频谱图(横轴:频率;纵轴:幅值)--傅里叶变换-->时频谱图【横轴:时间;纵轴:频率;颜色深浅:幅值】
- How to bind SQL statements to web buttons
- 野风药业IPO被终止:曾拟募资5.4亿 实控人俞蘠曾进行P2P投资
- 【批处理DOS-CMD命令-汇总和小结】-环境变量、路径变量、搜索文件位置相关指令——set、path、where,cmd命令的路径参数中有空格怎么办
- 盲测调查显示女码农比男码农更优秀
- [c++ primer notes] Chapter 4 expression
- Implementation of game hexagon map
猜你喜欢
js输出1-100之间所有的质数并求总个数
log4j:WARN No such property [zipPermission] in org. apache. log4j. RollingFileAppender.
win10-如何管理开机启动项?
What is a magnetic separator?
[12. maximum continuous non repeating subsequence]
二叉树结构以及堆结构基础
Common operation and Principle Exploration of stream
win命令行中导入、导出数据库相关表
【批处理DOS-CMD命令-汇总和小结】-cmd的内部命令和外部命令怎么区分,CMD命令和运行(win+r)命令的区别,
js来打印1-100间的质数并求总个数优化版
随机推荐
R language calculates Spearman correlation coefficient in parallel to speed up the construction of co occurrence network
基础知识 | js基础
期货反向跟单—交易员的培训问题
【批处理DOS-CMD命令-汇总和小结】-cmd的内部命令和外部命令怎么区分,CMD命令和运行(win+r)命令的区别,
Helix QAC is updated to 2022.1 and will continue to provide high standard compliance coverage
盲測調查顯示女碼農比男碼農更優秀
js输出形状
Closure problem
File and multipartfile overview
爬一个网页的所有导师信息
[notes on c++ primer] Chapter 3 string, vector and array
Import and export database related tables from the win command line
【c ++ primer 笔记】第4章 表达式
JS find the number of all daffodils
若xn>0,且x(n+1)/xn>1-1/n(n=1,2,...),证明级数∑xn发散
JDBC transaction commit case
突破从0到1后,鲜花电商2.0时代怎么走?
参考 | Win11 开启热点之后电脑不能上网
【批处理DOS-CMD命令-汇总和小结】-批处理命令中的参数%0、%1、%2、%[0-9]、%0-9和批处理命令参数位置切换命令shift,dos命令中操作符%用法
Basic knowledge | JS Foundation