This commit is contained in:
@@ -1,47 +1,58 @@
|
||||
/* 外层容器:改用Flex布局承载轮播图+箭头(核心修改) */
|
||||
|
||||
/* 外层容器:完全保留你的REM样式 */
|
||||
.carousel-wrapper {
|
||||
width: 100%;
|
||||
margin: 0 auto;
|
||||
/* 移除position: relative(无需定位) */
|
||||
display: flex; /* 核心:Flex布局 */
|
||||
align-items: center; /* 箭头与轮播图垂直居中 */
|
||||
justify-content: center; /* 整体水平居中 */
|
||||
gap: 0; /* 初始间距为0,后续通过箭头margin控制更灵活 */
|
||||
padding: 0; /* 可选:清除默认内边距 */
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 0;
|
||||
padding: 0;
|
||||
padding-top: 0.4rem;
|
||||
position: relative;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* 轮播容器整体样式(仅承载图片) */
|
||||
/* 轮播容器:核心 - REM控制最大宽度,宽度100%自适应 */
|
||||
.carousel-container {
|
||||
width: 1440px;
|
||||
max-width: 1440px;
|
||||
min-width: 1280px;
|
||||
/* 移除margin: 0 auto(Flex容器已居中) */
|
||||
overflow: hidden;
|
||||
width: 100%;
|
||||
max-width: 14.4rem; /* 你的REM限制,保留 */
|
||||
overflow: hidden !important;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
|
||||
flex-shrink: 0; /* 防止轮播图容器被Flex挤压 */
|
||||
flex-shrink: 0;
|
||||
box-sizing: border-box !important;
|
||||
transform: translateZ(0);
|
||||
clip-path: inset(0 1px 0 0);
|
||||
}
|
||||
|
||||
/* 轮播图片列表 */
|
||||
/* 轮播图片列表:flex布局,无固定宽度,靠子元素撑满 */
|
||||
.carousel-imgs {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
transition: transform 0.5s ease;
|
||||
transition: transform 0.5s ease-out; /* 顺滑过渡 */
|
||||
will-change: transform; /* 性能优化 */
|
||||
height: auto;
|
||||
flex-wrap: nowrap; /* 禁止换行 */
|
||||
margin: 0 !important;
|
||||
padding: 0 !important;
|
||||
}
|
||||
|
||||
/* 单张轮播图样式 */
|
||||
/* 单张图片:REM控制最大宽度,宽度100%继承容器 */
|
||||
.carousel-img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
flex-shrink: 0;
|
||||
object-fit: cover;
|
||||
max-width: 14.4rem; /* 你的REM限制,保留 */
|
||||
flex-shrink: 0; /* 禁止收缩 */
|
||||
object-fit: cover; /* 保持比例,不拉伸 */
|
||||
height: auto; /* 高度自适应 */
|
||||
display: block; /* 去除默认间隙 */
|
||||
margin: 0 !important;
|
||||
padding: 0 !important;
|
||||
image-rendering: crisp-edges;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* 图片版箭头样式(Flex版,移除定位相关属性) */
|
||||
/* 箭头样式:完全保留你的REM样式 */
|
||||
.carousel-arrow {
|
||||
/* 箭头容器尺寸(保留原有) */
|
||||
width: 0.77rem;
|
||||
height: 0.77rem;
|
||||
background: transparent;
|
||||
@@ -55,80 +66,93 @@
|
||||
transition: all 0.3s ease;
|
||||
opacity: 0.85;
|
||||
user-select: none;
|
||||
flex-shrink: 0; /* 防止箭头被Flex挤压 */
|
||||
/* 控制箭头与轮播图的间距(核心:替代定位的left/right) */
|
||||
margin: 0 20px; /* 可自定义箭头与轮播图的左右间距,比如改10px/30px */
|
||||
flex-shrink: 0;
|
||||
margin: 0 20px;
|
||||
/* position: absolute;
|
||||
top: 50%;
|
||||
transform: translateY(-50%); */
|
||||
}
|
||||
|
||||
/* 箭头图片样式(保留原有) */
|
||||
.carousel-arrow img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: contain;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
/* hover动效(修改transform,移除translateY(-50%)) */
|
||||
.carousel-arrow:hover {
|
||||
opacity: 1;
|
||||
transform: scale(1.1); /* 仅保留缩放,无需 translateY */
|
||||
transform: translateY(-50%) scale(1.1);
|
||||
box-shadow: 0 6px 20px rgba(0, 120, 255, 0.4);
|
||||
}
|
||||
|
||||
/* 移除定位相关的箭头位置控制(Flex布局无需) */
|
||||
.arrow-left {
|
||||
margin-right: 1rem;
|
||||
/* left: 0; */
|
||||
}
|
||||
.arrow-right {
|
||||
margin-left: 1rem;
|
||||
margin-left: 1rem;
|
||||
/* right: 0; */
|
||||
}
|
||||
|
||||
/* 轮播下方文字区域(保留原有) */
|
||||
/* 文字区域:完全保留你的REM样式 */
|
||||
.carousel-texts {
|
||||
max-width: 1440px;
|
||||
min-width: 1280px;
|
||||
box-sizing: border-box;
|
||||
max-width: 14.4rem;
|
||||
margin: 0 auto;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding-top: 1rem;
|
||||
|
||||
/* padding-top: 1rem; */
|
||||
position: relative;
|
||||
z-index: 10;
|
||||
padding:1rem 0.28rem 0 0.52rem;
|
||||
}
|
||||
|
||||
/* 文字高亮样式(保留原有) */
|
||||
.carousel-text {
|
||||
border-bottom: 3px solid transparent;
|
||||
transition: all 0.3s ease;
|
||||
cursor: pointer;
|
||||
border-radius: 4px;
|
||||
color:#48494D
|
||||
color:#48494D;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.carousel-text.active {
|
||||
/* font-weight: bold; */
|
||||
transform: translateY(-3px);
|
||||
color: #fff !important;
|
||||
/* border-bottom-color: #fff; */
|
||||
}
|
||||
|
||||
.carousel-text-t {
|
||||
font-size: 0.32rem;
|
||||
text-align: center;
|
||||
/* color:#48494D */
|
||||
|
||||
}
|
||||
.carousel-text-t1{
|
||||
font-size: clamp(18px, 1vw, 0.26rem);
|
||||
font-size: clamp(0.18rem, 1vw, 0.26rem); /* REM版clamp */
|
||||
text-align: center;
|
||||
/* color:#48494D */
|
||||
}
|
||||
.carousel-text-p1 {
|
||||
font-size:clamp(16px, 1vw, 0.22rem);
|
||||
padding-top: 0.28rem;
|
||||
text-align: center;
|
||||
font-family: "HarmonyOS-Light";
|
||||
font-size: clamp(0.16rem, 1vw, 0.22rem); /* REM版clamp */
|
||||
padding-top: 0.28rem;
|
||||
text-align: center;
|
||||
font-family: "HarmonyOS-Light";
|
||||
}
|
||||
.carousel-text-p {
|
||||
font-size:clamp(16px, 1vw, 0.22rem);
|
||||
font-size: clamp(0.16rem, 1vw, 0.22rem); /* REM版clamp */
|
||||
padding-top: 0.3rem;
|
||||
text-align: center;
|
||||
font-family: "HarmonyOS-Light";
|
||||
/* color:#48494D */
|
||||
font-family: "HarmonyOS-Light";
|
||||
}
|
||||
|
||||
/* 响应式适配:小屏幕REM缩放 */
|
||||
@media (max-width: 768px) {
|
||||
.carousel-arrow {
|
||||
width: 0.6rem;
|
||||
height: 0.6rem;
|
||||
margin: 0 0.1rem;
|
||||
}
|
||||
.arrow-left {
|
||||
margin-right: 0.5rem;
|
||||
}
|
||||
.arrow-right {
|
||||
margin-left: 0.5rem;
|
||||
}
|
||||
.carousel-text-t {
|
||||
font-size: 0.28rem;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user