css - Next.js 样式 - 页脚组件由于某种原因不在屏幕底部?
问题描述
Next.js 样式 - 页脚组件由于某种原因不在屏幕底部?
import Head from "next/head";
import Navbar from "./Navbar";
import Footer from "./Footer";
const layoutStyle = {
display: "flex",
flexDirection: "column",
height: "100%",
width: "100%"
};
const Layout = props => (
<div className="Layout" style={layoutStyle}>
<Head>
<title>Oracle</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta charSet="utf-8" />
</Head>
<Navbar />
<div>{props.children}</div>
<Footer/>
</div>
);
导出默认布局;
页脚
import React, { Component, Fragment } from "react";
class Footer extends Component {
render() {
return (
<div className="bg-gray-100">
<div className="bg-gray-100 container mx-auto px-6 pt-10 pb-6" >
>
© Oracle Corp. All rights reserved.
</div>
</div>
)
}
}
export default Footer;
我知道这与 next.js 有关,但不确定如何修复:/
我认为与下一步如何设置每个页面有关?
提前致谢,
解决方案
我能够footer
通过将内联样式添加Footer
到style={{ position: "absolute", bottom: 0, width:"100%" }}
. 该组件看起来像:
import React, { Component, Fragment } from "react";
class Footer extends Component {
render() {
return (
<div style={{ position: "absolute", bottom: 0, width:"100%" }} className="bg-gray-100">
<div className="bg-gray-100 container mx-auto px-6 pt-10 pb-6">
> © Oracle Corp. All rights reserved.
</div>
</div>
);
}
}
export default Footer;
推荐阅读
- ruby-on-rails-5 - 如何从表和关联表中返回特定列
- c - 使用不在 System32 中的 DLL
- ios - Swift - 如何过滤多维数组
- python - 是否可以通过 QML 从 PySide2 插槽(服务调用)获取对象列表?
- opengl - 了解这个 YUV 到 RGB 转换的着色器
- bash - 在显示实时输出的函数中执行命令
- android - Firestore 多次写入同一个文档并停止工作一段时间
- python - 如何正确使用 pitch_shift (librosa)?
- java - 我如何从 Spring Security 抛出自定义响应
- azure-devops - 在 Linux 代理上读取 JSON 文件并将其部署在 DCOS 上