模板:Index2025/Card1/style.css
来自EaseCation Wiki
更多操作
.card-1-container {
display: flex;
gap: 10px; /* 中间间隔10px */
width: 100%;
box-sizing: border-box;
margin-top: 10px;
height: 300px;
font-size: 16px;
}
.card-1-left {
background-color: rgba(57, 197, 187, 0.1);
backdrop-filter: blur(10px); /* 背景模糊效果 */
flex: 4;
border-radius: 10px;
padding: 15px;
box-sizing: border-box;
border: 1px solid rgba(0, 0, 0, 0.05);
}
.card-1-left-text {
font-size: 15px;
}
.card-1-right1 {
background-color: rgba(57, 197, 187, 0.1);
backdrop-filter: blur(10px); /* 背景模糊效果 */
flex: 2;
border-radius: 10px;
padding: 15px;
box-sizing: border-box;
border: 1px solid rgba(0, 0, 0, 0.05);
}
.card-1-right1-text {
font-size: 15px;
}
.card-1-left {
background-color: rgba(57, 197, 187, 0.1);
backdrop-filter: blur(10px); /* 背景模糊效果 */
flex: 4;
border-radius: 10px;
padding: 15px;
box-sizing: border-box;
border: 1px solid rgba(0, 0, 0, 0.05);
}
.card-1-left-text {
font-size: 15px;
}
.card-1_title {
font-weight: bold;
margin-bottom: 10px;
font-size: 1.2em;
}
.card-1-right {
background-color: rgba(72, 255, 0, 0.1);
backdrop-filter: blur(10px);
flex: 2;
border-radius: 10px;
padding: 0; /* 移除内边距,让图片充满容器 */
box-sizing: border-box;
border: 1px solid rgba(0, 0, 0, 0.05);
position: relative; /* 为内部绝对定位元素提供参考 */
overflow: hidden; /* 隐藏超出容器的内容 */
height: 100%; /* 继承容器高度 */
}
.card-1-right-image {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 1; /* 图片在底层 */
}
/* 为图片添加从下至上的黑色渐变蒙版 */
.card-1-right-image::after {
content: '';
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 100%;
background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0) 100%);
pointer-events: none; /* 允许点击穿透到图片 */
}
/* 实际图片样式 */
.card-1-right-image img {
width: 100%;
height: 100%;
object-fit: cover; /* 保持图片比例并覆盖整个容器 */
}
.card-1-right-foreground {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
padding: 15px;
box-sizing: border-box;
z-index: 2; /* 文字在蒙版上方 */
color: white; /* 文字颜色设为白色,与深色蒙版对比 */
}
.card-1-right-texts {
display: flex;
flex-direction: column; /* 垂直排列文字 */
gap: 5px; /* 文字间距 */
}
/* 调整文字顺序:subtitle在上,title在下 */
.card-1-right-foreground-subtitle {
order: 1; /* 排在前面 */
margin: 0;
font-size: 0.9em;
opacity: 0.9;
}
.card-1-right-foreground-title {
order: 2; /* 排在后面 */
margin: 0;
font-weight: bold;
display: flex;
flex-direction: column; /* 让主标题和副标题垂直排列 */
}
.card-1-right-foreground-title small {
font-weight: normal;
font-size: 0.8em;
opacity: 0.8;
margin-top: 3px;
}
@media (max-width: 768px) {
.card-1-container {
flex-direction: column; /* 改为垂直排列 */
height: auto; /* 自动适应内容高度 */
}
.card-1-left, .card-1-right, .card-1-right1 {
width: 100%; /* 确保占满宽度 */
min-height: 180px; /* 移动端最小高度 */
}
/* 调整移动端文字大小,确保可读性 */
.card-1-left-text, .card-1-right1-text {
font-size: 14px;
}
.card-1-right-foreground {
padding: 12px; /* 适当减小内边距 */
}
.card-1_title {
font-size: 16px;
}
}