Skip to content

Commit 86e89cc

Browse files
authored
Merge pull request #45 from Maa-NTE/fix/csswidth-blade
fix(css) : 修复页面在移动端超出屏幕问题
2 parents 7ee0e52 + 5730b6b commit 86e89cc

3 files changed

Lines changed: 50 additions & 1 deletion

File tree

docs/.vuepress/components/HHero.vue

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,13 @@ const actions = computed<HeroAction[]>(() => heroData.value.actions ?? [])
102102
}
103103
104104
.hero-content {
105-
width: max-content;
105+
width: 100%;
106106
max-width: 960px;
107107
padding: 0 20px;
108108
margin: 0 auto;
109109
text-align: center;
110110
pointer-events: none;
111+
box-sizing: border-box;
111112
}
112113
113114
.hhero.full .hero-container .hero-content {
@@ -158,6 +159,25 @@ const actions = computed<HeroAction[]>(() => heroData.value.actions ?? [])
158159
pointer-events: auto;
159160
}
160161
162+
@media (max-width: 480px) {
163+
.hero-name,
164+
.hero-tagline {
165+
font-size: 32px;
166+
line-height: 1.2;
167+
overflow-wrap: break-word;
168+
}
169+
170+
.hero-text {
171+
font-size: 15px;
172+
overflow-wrap: break-word;
173+
}
174+
175+
.actions {
176+
gap: 10px 16px;
177+
margin-top: 22px;
178+
}
179+
}
180+
161181
@media (min-width: 768px) {
162182
.hero-name,
163183
.hero-tagline {

docs/.vuepress/components/HomeIntro.vue

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,10 @@ defineProps<{
6666
font-size: 36px;
6767
font-weight: 700;
6868
width: fit-content;
69+
max-width: 100%;
6970
margin: 0 0 16px;
7071
padding: 5px;
72+
overflow-wrap: break-word;
7173
background: var(--vp-bg-home-hero-name, linear-gradient(315deg, var(--vp-c-purple-1) 15%, var(--vp-c-brand-2) 65%, var(--vp-c-brand-2) 100%));
7274
background-clip: text;
7375
-webkit-background-clip: text;
@@ -93,4 +95,15 @@ defineProps<{
9395
font-weight: 500;
9496
text-decoration: none;
9597
}
98+
99+
@media (max-width: 480px) {
100+
.home-intro-title {
101+
font-size: 26px;
102+
}
103+
104+
.home-intro-text {
105+
font-size: 15px;
106+
padding: 0 5px;
107+
}
108+
}
96109
</style>

docs/.vuepress/styles/custom.css

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,22 @@
1010
margin-top: 10vh;
1111
}
1212

13+
/* 全局:防止移动端横向溢出 */
14+
html,
15+
body {
16+
overflow-x: hidden;
17+
}
18+
19+
/* 图片等标签调整 */
20+
img,
21+
video,
22+
iframe,
23+
table,
24+
pre,
25+
code {
26+
max-width: 100%;
27+
}
28+
1329
/* 语言切换和外观切换按钮在 1024px+ 时直接显示(原为 1280px+) */
1430
/* 避免在中等屏宽下被收入 "..." 菜单中导致不可见 */
1531
@media (min-width: 1024px) {

0 commit comments

Comments
 (0)