admin管理员组文章数量:1401673
I'm facing an issue with Next.js 14 where my layout breaks on laptops and other devices that have Windows display scaling enabled by default. Some UI elements get misaligned, and the overall layout looks off.
To fix this, I want to force the initial viewport to be set to a standard 100%, ignoring any scaling settings. Here's what I tried:
export const viewport: Viewport = {
width: 'device-width',
initialScale: 1,
maximumScale: 1,
minimumScale: 1,
userScalable: false,
};
export default function RootLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
return (
<html lang='en'>
<body className={roboto.className}>
<Navbar menuData={menuData}></Navbar>
{children}
<footer>
<Footer></Footer>
</footer>
</body>
</html>
);
}
However, this doesn't seem to have any effect in the browser.
Am I missing something? How can I properly enforce a fixed initial scale to prevent layout issues caused by Windows scaling?
Any help would be greatly appreciated!
本文标签: reactjsNextjs 14 – How to Force Initial Viewport to 100 to Fix Scaling IssuesStack Overflow
版权声明:本文标题:reactjs - Next.js 14 – How to Force Initial Viewport to 100% to Fix Scaling Issues? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744311780a2600064.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论