mirror of
https://github.com/Cp0204/quark-auto-save.git
synced 2026-01-13 15:50:45 +08:00
优化 Toast 通知为内容自适应并统一居中显示
- 移除固定宽度上限,按内容自适应宽度 - 超长时最大宽度改为 calc(100vw - 20px),页面左右边距各 10px - 始终居中显示:容器居中 + 显示阶段强制 inline-block - 固定顶部距离为 64px,内容换行不影响上边距 - 文本自动换行且保持居中,对超长英文/URL 友好 - 微调垂直内边距,总高度净减少 1px - 桌面端与移动端样式一致,不影响其他组件/交互
This commit is contained in:
parent
8063ec0cf8
commit
8a35a25358
@ -101,23 +101,35 @@ body.login-page {
|
||||
/* --------------- Toast 通知组件 --------------- */
|
||||
.toast-container-center {
|
||||
position: fixed;
|
||||
top: 90.5px;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
top: 64px;
|
||||
left: 0;
|
||||
right: 0;
|
||||
margin: 0 auto;
|
||||
transform: none; /* 固定顶部距离,不随内容高度变化 */
|
||||
z-index: 9999;
|
||||
width: auto;
|
||||
max-width: 80%;
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
pointer-events: none;
|
||||
text-align: center; /* 容器内居中,使移动端与桌面端一致 */
|
||||
padding: 0 10px; /* 页面左右各 10px 的安全边距 */
|
||||
}
|
||||
|
||||
.toast-custom {
|
||||
min-width: 120px;
|
||||
background-color: var(--focus-border-color);
|
||||
box-shadow: 0 3px 7px rgba(0, 0, 0, 0.1);
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
margin: 0 auto;
|
||||
width: fit-content;
|
||||
margin: 0; /* 由容器 padding 提供页面边距限制,避免强制扩张 */
|
||||
display: inline-block; /* 保持根据内容自适应,同时允许换行后包裹 */
|
||||
width: -moz-fit-content;
|
||||
width: fit-content; /* 内容自适应宽度 */
|
||||
max-width: calc(100vw - 20px); /* 视口宽度减去左右 10px */
|
||||
}
|
||||
|
||||
/* Bootstrap 在显示阶段可能将 .toast 设为 block,强制保持 inline-block 以持续居中 */
|
||||
.toast-custom.show,
|
||||
.toast-custom.showing {
|
||||
display: inline-block !important;
|
||||
}
|
||||
|
||||
.toast-body-custom {
|
||||
@ -125,7 +137,11 @@ body.login-page {
|
||||
padding: 0.93rem 1.2rem;
|
||||
color: #fff;
|
||||
font-size: 0.95rem;
|
||||
white-space: nowrap;
|
||||
white-space: normal;
|
||||
word-break: break-word;
|
||||
margin: 0 auto; /* 保持正文在容器中水平居中 */
|
||||
padding-top: calc(0.93rem - 0.25px);
|
||||
padding-bottom: calc(0.93rem - 0.25px);
|
||||
}
|
||||
|
||||
/* --------------- 底部按钮 --------------- */
|
||||
|
||||
Loading…
Reference in New Issue
Block a user