css奖杯制作
CSS奖杯制作方法
使用CSS创建一个奖杯效果可以通过渐变、阴影和形状组合实现。以下是一个完整的实现方案:
HTML结构

<div class="trophy">
<div class="cup"></div>
<div class="base"></div>
</div>
CSS样式

.trophy {
position: relative;
width: 100px;
height: 180px;
margin: 50px auto;
}
.cup {
width: 80px;
height: 100px;
background: linear-gradient(to bottom, #FFD700, #FFA500);
border-radius: 40px 40px 0 0;
position: absolute;
top: 0;
left: 10px;
box-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
}
.cup::before {
content: "";
position: absolute;
width: 20px;
height: 20px;
background: #FFD700;
border-radius: 50%;
top: -10px;
left: 30px;
}
.base {
width: 60px;
height: 20px;
background: linear-gradient(to bottom, #C0C0C0, #A9A9A9);
position: absolute;
bottom: 0;
left: 20px;
border-radius: 5px;
box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}
进阶效果增强
添加光泽效果和3D感:
.cup::after {
content: "";
position: absolute;
width: 30px;
height: 60px;
background: rgba(255,255,255,0.3);
border-radius: 15px;
top: 20px;
left: 25px;
transform: rotate(30deg);
}
.base::before {
content: "";
position: absolute;
width: 40px;
height: 10px;
background: linear-gradient(to right, #E6E6E6, #C0C0C0);
top: -5px;
left: 10px;
border-radius: 3px;
}
动画效果
添加旋转动画让奖杯更生动:
@keyframes shine {
0% { box-shadow: 0 0 10px rgba(255, 215, 0, 0.8); }
50% { box-shadow: 0 0 20px rgba(255, 215, 0, 0.9); }
100% { box-shadow: 0 0 10px rgba(255, 215, 0, 0.8); }
}
.trophy:hover {
animation: spin 2s linear infinite;
}
@keyframes spin {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}
.cup {
animation: shine 3s ease-in-out infinite;
}
这些代码组合可以创建一个具有金属质感、光泽效果和交互动画的CSS奖杯。通过调整颜色值、尺寸和动画参数,可以进一步定制奖杯的外观效果。






