修复了公告栏文字未上下居中的问题

This commit is contained in:
2026-06-12 23:38:36 +08:00
parent 84be8489b4
commit 6691ebd85e
3 changed files with 55 additions and 57 deletions

0
1.py Normal file
View File

View File

@@ -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; */
/* 或者使用方法3translate上移 */
/* 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%);

View File

@@ -1,29 +1,42 @@
{
"compileType": "miniprogram",
"setting": {
"coverView": true,
"es6": true,
"postcss": true,
"minified": true,
"enhance": true,
"showShadowRootInWxmlPanel": true,
"packNpmRelationList": [],
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
},
"ignoreUploadUnusedFiles": true
},
"condition": {},
"editorSetting": {
"tabIndent": "insertSpaces",
"tabSize": 4
},
"libVersion": "3.14.3",
"packOptions": {
"ignore": [],
"include": []
},
"appid": "wx0e4be86faac4a8d1"
{
"compileType": "miniprogram",
"setting": {
"coverView": true,
"es6": true,
"postcss": true,
"minified": true,
"enhance": true,
"showShadowRootInWxmlPanel": true,
"packNpmRelationList": [],
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
},
"ignoreUploadUnusedFiles": true,
"compileWorklet": false,
"uglifyFileName": false,
"uploadWithSourceMap": true,
"packNpmManually": false,
"minifyWXSS": true,
"minifyWXML": true,
"localPlugins": false,
"disableUseStrict": false,
"useCompilerPlugins": false,
"condition": false,
"swc": false,
"disableSWC": true
},
"condition": {},
"editorSetting": {
"tabIndent": "insertSpaces",
"tabSize": 4
},
"libVersion": "3.14.3",
"packOptions": {
"ignore": [],
"include": []
},
"appid": "wx0e4be86faac4a8d1",
"simulatorPluginLibVersion": {}
}