React CSS 内联样式

React CSS About 593 words

代码

export default function GlobalStyle() {
    return (
        <style global jsx>{`
            html,
            body {
                max-width: 100vw;
                overflow-x: hidden;
            }

            * {
                box-sizing: border-box;
                padding: 0;
                margin: 0;
            }
        `}</style>
    )
}

引用

export default function RootLayout({children}: Readonly<{
    children: React.ReactNode;
}>) {
    return (
        <html lang="en">
        <GlobalStyle/>
        <body>
        {children}
        </body>
        </html>
    );
}
Views: 10 · Posted: 2025-12-10

————        END        ————

Give me a Star, Thanks:)

https://github.com/fendoudebb/LiteNote

扫描下方二维码关注公众号和小程序↓↓↓

扫描下方二维码关注公众号和小程序↓↓↓
Today In History
Browsing Refresh