【发布时间】:2021-12-14 09:44:53
【问题描述】:
我的页面使用 100% 宽度时遇到了问题。它在桌面上运行良好,占据整个页面宽度,但在移动设备上它变得很奇怪。我正在使用 NextJS 和 Material-UI,如果它有什么不同的话。我尝试设置宽度:100%,但没有任何改变。
我的 CSS 是:
global.css:
html,
body {
padding: 0;
margin: 0;
font-family: 'Roboto', sans-serif;
}
a {
color: inherit;
text-decoration: none;
}
* {
box-sizing: border-box;
}
_app.js
<Head>
<title>E-commerce</title>
<meta
name="viewport"
content="initial-scale=1.0, width=device-width"
/>
</Head>
这是移动设备上的正文宽度。 HTML,正文宽度为灰色部分
【问题讨论】:
-
请在可运行的 sn-p 中添加所有必要的代码(HTML、CSS、JS),以便我们查看发生了什么。如何? stackoverflow.com/help/minimal-reproducible-example。根据您发布的内容,我们看不到问题。