html - 如何在材质ui中对齐屏幕底部的项目
问题描述
我正在尝试在屏幕末尾对齐按钮,这样即使我滚动背景列表,该按钮仍应保留在屏幕底部。我试过但无法解决这个问题。任何人都请帮我这样做。
这是我的代码
<Link to={"/checkout-summary"}>
<div className="checkoutbtn">
<Button
style={{
boxShadow: "none",
borderRadius: "0px",
position: 'absolute',
bottom: 0
}}
variant="contained"
color="primary"
>
Check Out
</Button>
</div>
</Link>
解决方案
将页脚固定到底部
import { makeStyles } from '@material-ui/core/styles';
const useStyles = makeStyles(theme => ({
footer: {
position: 'fixed',
bottom: 0,
width: '100%',
height: 60,
textAlign: 'center'
}
}));
const classes = useStyles();
<Link to={"/checkout-summary"} className={classes.footer}>
推荐阅读
- data-structures - 嵌套循环最有效的数据结构?
- java - 无法将 json 测试数据文件读入我的 stepDef
- python - 代码在字符串拆分中未按预期工作
- php - 我试图将数据添加到数据库中的用户表中
- java - 不仅为工作区创建启动配置,还为该特定语言创建启动配置
- python - 如何使用列表理解来输出列表中的昆虫数量?
- abp - ABP.IO 自定义基本主题编译错误
- php - 使用 %name% PHP + Mysql 标签在 TinyMCE 编辑器中键入文本时按名称调用用户
- python - 将 numba 用于树结构的准则是什么?
- cross-domain - 介子构建:如何使用编译库而不是将其作为子项目下载并构建