Fix horizontal overflow across the site on phone and tablet widths
- Add box-sizing: border-box and img/svg/video max-width:100% reset - Add min-width:0 to grid/flex children so they can shrink (hero panel, layout grid, metric grid) - Allow long text to wrap (mock-state query strings, long stop names) - Topbar: hide CTA button until 1024px, hide brand subtitle until 768px, and wrap the bar onto two lines under 360px so nav is never cut off Verified with headless Chrome at 320/375/414/640/768/1024/1280/1600px: zero horizontal overflow on all 7 routes.
This commit is contained in:
1 parent
38c7cc27c1
commit
0a464b6b18
1 file changed
+22
-2
+22
-2
@@ -19,6 +19,19 @@
|
||||
html { -webkit-text-size-adjust: 100%; }
|
||||
body { font-size: 15px; }
|
||||
|
||||
/* --- กัน overflow พื้นฐาน (padding/รูป/grid/ข้อความยาว ไม่ให้ล้นจอมือถือ) --- */
|
||||
*, *::before, *::after { box-sizing: border-box; }
|
||||
img, svg, video { max-width: 100%; height: auto; }
|
||||
/* grid/flex child ต้อง shrink ได้ (กัน min-width:auto ล้น container) */
|
||||
#view .mu-hero-panel > *,
|
||||
#view .mu-layout-grid > *,
|
||||
#view .mu-hero-metric-grid > *,
|
||||
#view .mu-stop-summary-main { min-width: 0; }
|
||||
/* ข้อความยาวไม่ break (เช่น mock state query string / ชื่อยาว) */
|
||||
#view .mu-inline-context strong,
|
||||
#view .mu-stop-hero-title,
|
||||
#view .mu-stop-hero-sub { overflow-wrap: anywhere; }
|
||||
|
||||
.mu-container { padding: 0 16px; }
|
||||
main.mu-container { padding-top: 24px; padding-bottom: 24px; }
|
||||
|
||||
@@ -111,6 +124,13 @@ main.mu-container { padding-top: 14px; padding-bottom: 14px; }
|
||||
.mu-footer-grid { grid-template-columns: 1fr; gap: 20px; }
|
||||
.mu-sponsor-strip { grid-template-columns: repeat(2, 1fr); gap: 8px; }
|
||||
|
||||
/* --- จอแคบมาก (≤360px): topbar ห่อแถว ไม่ให้ nav ถูกตัด --- */
|
||||
@media (max-width: 360px) {
|
||||
.mu-topbar-inner { flex-wrap: wrap; }
|
||||
.mu-nav { order: 3; width: 100%; justify-content: space-between; margin-left: 0; }
|
||||
.mu-lang-switch { margin-left: auto; }
|
||||
}
|
||||
|
||||
/* ============================================================
|
||||
≥480px — มือถือใหญ่
|
||||
============================================================ */
|
||||
@@ -129,9 +149,7 @@ main.mu-container { padding-top: 14px; padding-bottom: 14px; }
|
||||
@media (min-width: 640px) {
|
||||
body { font-size: 16px; }
|
||||
.mu-container { padding: 0 28px; }
|
||||
.mu-brand-subtitle { display: block; font-size: .72rem; }
|
||||
.mu-brand-title { font-size: 1.05rem; }
|
||||
.mu-action-btn { display: inline-flex; }
|
||||
.mu-topbar-inner { gap: 18px; padding: 14px 28px; overflow: visible; }
|
||||
.mu-logo-img { width: 44px; height: 44px; }
|
||||
.mu-nav { gap: 24px; }
|
||||
@@ -156,6 +174,7 @@ main.mu-container { padding-top: 14px; padding-bottom: 14px; }
|
||||
≥768px — iPad แนวตั้ง / แท็บเล็ต
|
||||
============================================================ */
|
||||
@media (min-width: 768px) {
|
||||
.mu-brand-subtitle { display: block; font-size: .72rem; }
|
||||
#view .mu-kpi-grid { grid-template-columns: repeat(4, 1fr); }
|
||||
#view .mu-info-grid { grid-template-columns: repeat(4, 1fr); }
|
||||
#view .mu-hero-metric-grid { grid-template-columns: repeat(4, 1fr); }
|
||||
@@ -170,6 +189,7 @@ main.mu-container { padding-top: 14px; padding-bottom: 14px; }
|
||||
============================================================ */
|
||||
@media (min-width: 1024px) {
|
||||
.mu-hero { padding: 56px 0 64px; }
|
||||
.mu-action-btn { display: inline-flex; }
|
||||
.mu-hero h1 { font-size: clamp(2.2rem, 4vw, 3rem); }
|
||||
.mu-hero-actions { padding: 0; }
|
||||
#view .mu-layout-grid { grid-template-columns: 1.35fr .9fr; gap: 16px; }
|
||||
|
||||
Reference in new issue
Block a user