4. 文字效果/2D-3D转换 - 3D翻转卡片

4. 文字效果/2D-3D转换 - 3D翻转卡片

案例:3D产品展示卡片

html 复制代码
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<style type="text/css">
		.scene {
		    width: 300px;
		    height: 400px;
		    perspective: 1000px;
		    margin: 50px auto;
		  }
		  
		  .card {
		    width: 100%;
		    height: 100%;
		    position: relative;
		    transition: transform 1s;
		    transform-style: preserve-3d;
		  }
		  
		  .scene:hover .card {
		    transform: rotateY(180deg);
		  }
		  
		  .card-face {
		    position: absolute;
		    width: 100%;
		    height: 100%;
		    backface-visibility: hidden;
		    border-radius: 10px;
		    overflow: hidden;
		    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
		  }
		  
		  .card-front {
		    background: linear-gradient(45deg, #ff9a9e, #fad0c4);
		    display: flex;
		    flex-direction: column;
		    align-items: center;
		    justify-content: center;
		  }
		  
		  .card-back {
		    background: linear-gradient(45deg, #a18cd1, #fbc2eb);
		    transform: rotateY(180deg);
		    padding: 20px;
		    box-sizing: border-box;
		  }
		  
		  .product-title {
		    font-size: 24px;
		    margin-bottom: 10px;
		    color: white;
		    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
		  }
		  
		  .product-image {
		    width: 80%;
		    filter: drop-shadow(5px 5px 10px rgba(0,0,0,0.2));
		  }
		  
		  .product-description {
		    color: white;
		    line-height: 1.6;
		  }
	</style>
	<body>
		<div class="scene">
		  <div class="card">
		    <div class="card-face card-front">
		      <h2 class="product-title">智能手表</h2>
		      <img src="smartwatch.png" class="product-image">
		    </div>
		    <div class="card-face card-back">
		      <h3>产品特性</h3>
		      <p class="product-description">
		        心率监测 | 运动追踪 | 50米防水<br>
		        14天续航 | 通知提醒 | 多种表盘
		      </p>
		      <div class="price">¥899</div>
		    </div>
		  </div>
		</div>
	</body>
</html>

相关推荐
苏打水com1 小时前
第十五篇:Day43-45 前端性能优化进阶——从“可用”到“极致”(对标职场“高并发场景优化”需求)
前端·css·vue·html·js
苏打水com1 小时前
第十六篇:Day46-48 前端安全进阶——从“漏洞防范”到“安全体系”(对标职场“攻防实战”需求)
前端·javascript·css·vue.js·html
幻云20102 小时前
WebGL与BabylonJS:前端3D开发入门
3d·webgl
普密斯科技2 小时前
从点测量到解决方案:光谱共焦技术如何集成于运动平台,实现3D轮廓扫描与透明物体测厚?
人工智能·算法·计算机视觉·3d·集成测试·测量
二狗哈3 小时前
Cesium快速入门24:Appearance编写着色器修改外观
3d·webgl·cesium·着色器·地图可视化
Yuner20004 小时前
WebGL与BabylonJS:前端3D开发学习指南
3d·webgl
Lunar*4 小时前
[开源] 纯前端实现楼盘采光模拟工具:从2D规划图到3D日照分析
前端·3d
旧梦吟4 小时前
脚本网页 地球演化
前端·算法·css3·html5·pygame
Можно5 小时前
ES6 Map 全面解析:从基础到实战的进阶指南
前端·javascript·html
BD_Marathon5 小时前
【JavaWeb】乱码问题_HTML_Tomcat日志_sout乱码问题
java·tomcat·html