【发布时间】:2021-11-15 18:53:09
【问题描述】:
编辑:我试图将页脚放在页面的最后。现在它不会去那里,页面末尾有一些空间
我读到 #__next 会导致问题,我尝试了很多替代方案;依然没有。我可能做错了什么,但我无法在展开页面时保留页脚和最底部。
function MyApp({ Component, pageProps }) {
return (
<StyledEngineProvider>
<Layout>
<Head>
<title>Covid19 Real Time Data</title>
<meta
name="viewport"
content="initial-scale=1.0, width=device-width"
/>
<link
rel="stylesheet"
href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap"
/>
</Head>
<Component {...pageProps} />
</Layout>
</StyledEngineProvider>
);
}
global.css
html,
body {
padding: 0;
margin: 0;
scroll-behavior: smooth;
font-family: 'Roboto', sans-serif;
}
#__next {
display: flex;
flex-direction: column;
min-height: 100vh;
}
纸质css
.paper {
display: flex;
flex-direction: column;
min-width: fit-content;
min-height: 100vh;
}
页脚组件
function Copyright() {
return (
<Typography variant="body2" color="text.secondary">
{'Copyright © '}
<Link color="inherit" href="https://www.linkedin.com/in/fabio-catino/">
Fabio Catino
</Link>{' '}
{new Date().getFullYear()}
</Typography>
);
}
export default function StickyFooter() {
return (
<Box
component="footer"
sx={{
py: 3,
px: 2,
pd: 3,
width: '100%',
// position: 'absolute',
bottom: 0,
backgroundColor: (theme) =>
theme.palette.mode === 'light'
? theme.palette.grey[200]
: theme.palette.grey[800],
}}
>
<Container maxWidth="sm">
<Copyright />
</Container>
</Box>
);
}
【问题讨论】:
-
嗨@FabioC!你能详细解释一下你的问题吗?
-
抱歉,我无法将您的问题与示例代码联系起来。你能说得更具体点吗?
-
我编辑了帖子,但基本上我试图摆脱页脚下的空白区域,让页脚始终位于底部
-
你还没有分享你的页脚组件代码...
-
@kazim066 我的错。刚刚添加