<div style="display: flex; flex-direction: column; gap: 15px; padding: 15px; background: #f8f9fa; border-radius: 12px;">
<style>
@keyframes fadeInUp {
from { opacity: 0; transform: translateY(20px); }
to { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
0% { box-shadow: 0 0 0 0 rgba(66, 153, 225, 0.4); }
70% { box-shadow: 0 0 0 10px rgba(66, 153, 225, 0); }
100% { box-shadow: 0 0 0 0 rgba(66, 153, 225, 0); }
}
@keyframes carousel {
0% { opacity: 0; transform: translateX(100%); }
10% { opacity: 1; transform: translateX(0); }
33.33% { opacity: 1; transform: translateX(0); }
43.33% { opacity: 0; transform: translateX(-100%); }
100% { opacity: 0; transform: translateX(-100%); }
}
.carousel-container {
position: relative;
height: 380px; /* 增加高度到380px */
overflow: hidden;
border-radius: 12px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
background: white;
}
.carousel-item {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
opacity: 0;
animation: carousel 12s infinite;
display: flex;
flex-direction: column;
padding: 20px;
box-sizing: border-box;
}
.carousel-item:nth-child(1) { animation-delay: 0s; }
.carousel-item:nth-child(2) { animation-delay: 4s; }
.carousel-item:nth-child(3) { animation-delay: 8s; }
.carousel-image {
width: 100%;
height: 200px; /* 增加图片高度 */
object-fit: cover;
border-radius: 10px;
margin-bottom: 15px;
}
.carousel-content {
flex-grow: 1;
display: flex;
flex-direction: column;
justify-content: space-between;
}
.carousel-title {
font-size: 18px;
font-weight: bold;
margin-bottom: 10px;
color: #333;
}
.carousel-description {
font-size: 14px;
color: #666;
margin-bottom: 15px;
line-height: 1.5;
flex-grow: 1; /* 允许描述区域扩展 */
}
.carousel-button {
display: inline-block;
padding: 10px 15px;
border-radius: 6px;
color: white;
text-decoration: none;
font-weight: bold;
text-align: center;
transition: all 0.3s ease;
cursor: pointer;
border: none;
font-size: 14px;
}
.btn-blue {
background: linear-gradient(135deg, #4285f4, #34a853);
}
.btn-green {
background: linear-gradient(135deg, #34a853, #0f9d58);
}
.btn-purple {
background: linear-gradient(135deg, #a142f4, #7b1fa2);
}
.carousel-button:hover {
transform: translateY(-2px);
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}
.carousel-button:active {
transform: translateY(1px);
}
.indicators {
display: flex;
justify-content: center;
margin-top: 10px;
}
.indicator {
width: 8px;
height: 8px;
border-radius: 50%;
background: #ccc;
margin: 0 4px;
transition: background 0.3s ease;
}
.indicator.active {
background: #4285f4;
}
</style>
<div class="carousel-container">
<!-- 卡片1 -->
<div class="carousel-item">
<img src="https://picsum.photos/seed/tech1/400/200.jpg" alt="技术趋势" class="carousel-image">
<div class="carousel-content">
<div>
<h3 class="carousel-title">2023年技术趋势</h3>
<p class="carousel-description">探索人工智能、量子计算和生物技术的最新突破,了解这些技术如何改变我们的生活和未来工作方式。</p>
</div>
<a href="https://example.com/tech-trends" class="carousel-button btn-blue" target="_blank">了解更多</a>
</div>
</div>
<!-- 卡片2 -->
<div class="carousel-item">
<img src="https://picsum.photos/seed/design2/400/200.jpg" alt="设计灵感" class="carousel-image">
<div class="carousel-content">
<div>
<h3 class="carousel-title">UI/UX设计灵感</h3>
<p class="carousel-description">发现最新的设计趋势、色彩搭配和用户体验技巧,提升您的产品设计水平,创造令人印象深刻的用户界面。</p>
</div>
<a href="https://example.com/design-inspiration" class="carousel-button btn-green" target="_blank">探索设计</a>
</div>
</div>
<!-- 卡片3 -->
<div class="carousel-item">
<img src="https://picsum.photos/seed/business3/400/200.jpg" alt="商业策略" class="carousel-image">
<div class="carousel-content">
<div>
<h3 class="carousel-title">创业商业策略</h3>
<p class="carousel-description">学习成功企业家的商业策略,了解市场定位、品牌建设和客户获取的有效方法,加速您的业务增长。</p>
</div>
<a href="https://example.com/business-strategy" class="carousel-button btn-purple" target="_blank">查看策略</a>
</div>
</div>
</div>
<div class="indicators">
<div class="indicator active"></div>
<div class="indicator"></div>
<div class="indicator"></div>
</div>
</div>