移动端网页适配异常:右侧出现空白区域求助
移动端适配问题:PC端显示正常,移动端右侧空白+头部适配异常
- PC端网页显示完全正常,但移动端无法适配屏幕,右侧出现空白区域,且无任何内容超出窗口范围
- 部分设置下还会出现头部无法适配的情况
问题截图
- 右侧空白区域:

- 头部不适配及空白:

HTML页面代码
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>@ViewBag.Title</title> <link rel="preconnect" href="https://fonts.googleapis.com"> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> <link href="https://fonts.googleapis.com/css2?family=Outfit:wght@100..900&display=swap" rel="stylesheet"> <link rel="stylesheet" href="~/styles/header.css"> <link rel="stylesheet" href="~/styles/footer.css"> <link rel="stylesheet" href="~/styles/general_index.css"> <link rel="stylesheet" href="~/styles/index_page.css"> </head> <body> <div class="background-container"> </div> </body> </html>
general_index.css代码
body { margin: 0; padding: 0; position: relative; background-color: #FDF1E6; font-family: Outfit, Arial, Helvetica, sans-serif; font-style: normal; color: #FFFFFF; width: 100%; /* take full browser width */ height: 100%; } .background-container { background-image: url("../background.jpg"); background-size: cover; background-position: center; background-attachment: fixed; display: flex; flex-direction: column; position: relative; padding-bottom: 650px; } body::before { content: ""; position: absolute; top: 0px; right: 0px; bottom: 0px; left: 0px; background-color: rgba(0,0,0,0.0); z-index: -1; }
内容的提问来源于stack exchange,提问作者HarryTra
相关产品推荐
相关产品推荐

