修复了公告栏文字未上下居中的问题
This commit is contained in:
@@ -4,13 +4,13 @@
|
||||
background: linear-gradient(180deg, #f5faff 0%, #f0f8ff 100%);
|
||||
}
|
||||
|
||||
/* ===== 2. 公告栏样式 - 物理上移方案 ===== */
|
||||
/* ===== 2. 公告栏样式 ===== */
|
||||
.gonggao-box {
|
||||
margin: 20rpx 30rpx;
|
||||
height: 80rpx;
|
||||
border-radius: 40rpx;
|
||||
background: linear-gradient(135deg,
|
||||
rgba(220, 255, 220, 0.85) 0%,
|
||||
background: linear-gradient(135deg,
|
||||
rgba(220, 255, 220, 0.85) 0%,
|
||||
rgba(255, 255, 200, 0.85) 100%);
|
||||
backdrop-filter: blur(10px);
|
||||
display: flex;
|
||||
@@ -18,10 +18,9 @@
|
||||
padding: 0 25rpx;
|
||||
box-shadow: 0 4rpx 15rpx rgba(0, 100, 0, 0.08);
|
||||
border: 1rpx solid rgba(255, 255, 255, 0.3);
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
|
||||
.gonggao-icon {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
@@ -30,47 +29,33 @@
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
|
||||
.gonggao-icon image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
|
||||
.gonggao-content {
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
height: 100%;
|
||||
position: relative;
|
||||
height: 80rpx;
|
||||
display: flex;
|
||||
margin-top: 2px; /* 视觉上的微小修正 */
|
||||
}
|
||||
|
||||
/* 关键修改:使用物理上移 */
|
||||
|
||||
.gonggao-text {
|
||||
font-size: 26rpx;
|
||||
color: #333;
|
||||
white-space: nowrap;
|
||||
padding-right: 50rpx;
|
||||
|
||||
/* 物理上移方法1:直接调整位置 */
|
||||
position: absolute;
|
||||
top: -5rpx; /* 从顶部开始计算位置 */
|
||||
left: 0;
|
||||
|
||||
/* 或者使用方法2:负margin上移 */
|
||||
/* position: relative;
|
||||
top: -10rpx; */
|
||||
|
||||
/* 或者使用方法3:translate上移 */
|
||||
/* transform: translateY(-5rpx); */
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
/* 尝试不同的上移值,直到居中为止 */
|
||||
/* 可以尝试的值:5rpx, 8rpx, 10rpx, 12rpx, 15rpx, 18rpx, 20rpx */
|
||||
|
||||
|
||||
.gonggao-anim {
|
||||
animation: marquee 10s linear infinite; /* 加快速度到10秒 */
|
||||
animation: marquee 10s linear infinite;
|
||||
animation-delay: 0.5s;
|
||||
}
|
||||
|
||||
|
||||
@keyframes marquee {
|
||||
0% {
|
||||
transform: translateX(100%);
|
||||
|
||||
Reference in New Issue
Block a user