div+css实现旅游目的地图文卡片左右列表滚动效果代码
代码语言:html
所属分类:布局界面
代码描述:div+css实现旅游目的地图文卡片左右列表滚动效果代码
代码标签: div css 旅游 目的地 图文 卡片 左右 列表 滚动
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<style>
:root {
/* Base colors */
--primary-color: #e67e22;
--secondary-color: #d35400;
--card-bg: #ffffff;
--card-text: #333333;
--card-shadow: rgba(0, 0, 0, 0.15);
--active-card-shadow: rgba(230, 126, 34, 0.4);
--carousel-bg: #fffaf5;
/* Destination-specific colors */
--kyoto-color: #c0392b;
--kyoto-color-hover: #a93226;
--santorini-color: #2980b9;
--santorini-color-hover: #2471a3;
--banff-color: #27ae60;
--banff-color-hover: #229954;
--bali-color: #d35400;
--bali-color-hover: #ba4a00;
--marrakech-color: #8e44ad;
--marrakech-color-hover: #7d3c98;
--machupicchu-color: #16a085;
--machupicchu-color-hover: #138d75;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
margin: 0;
padding: 0;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background: linear-gradient(135deg, #e67e22 0%, #8e44ad 100%);
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
min-height: 100vh;
color: var(--card-text);
padding: 2rem 1rem;
}
.title {
color: #fff9f0;
text-align: center;
margin-bottom: 2rem;
font-size: 2.2rem;
text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
font-weight: 800;
}
.subtitle {
color: #fff9f0;
text-align: center;
margin-top: -1rem;
margin-bottom: 2rem;
font-size: 1.1rem;
}
.carousel-container {
position: relative;
width: 100%;
max-width: 1200px;
}
/* Carousel */
.carousel {
display: flex;
gap: 20px;
width: 100%;
max-width: 90vw;
background-color: var(--carousel-bg);
border-radius: 12px;
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
padding: 20px;
overflow-x: auto;
scroll-snap-type: x mandatory;
scrollbar-width: none; /* Hide scrollbar for Firefox */
scroll-behavior: smooth;
-webkit-overflow-scrolling: touch;
position: relative;
}
.carousel::-webkit-scrollbar {
display: none;
}
.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0