为了账号安全,请及时绑定邮箱和手机立即绑定

如何在Material ui中对齐屏幕底部的项目

如何在Material ui中对齐屏幕底部的项目

潇湘沐 2023-10-17 16:58:35
我正在尝试在屏幕末尾对齐按钮,这样即使我滚动背景列表,按钮仍应保留在屏幕底部。我尝试过但无法弄清楚这一点。请任何人帮助我这样做。这就是我的屏幕的样子。现在,滚动时它总是出现在屏幕中间。这是我的代码<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>
查看完整描述

2 回答

?
幕布斯6054654

TA贡献1876条经验 获得超7个赞

将页脚固定到底部


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}>


查看完整回答
反对 回复 2023-10-17
?
神不在的星期二

TA贡献1963条经验 获得超6个赞

import { styled } from '@mui/system';

    

const MyMessageBox = styled('div')({

    position: 'fixed',

    bottom: 0,

    width: '100%',

    height: 60,

    textAlign: 'center',

});

      

<MyMessageBox>Contents inside this will be shown at the bottom of the page</MyMessageBox>



查看完整回答
反对 回复 2023-10-17
  • 2 回答
  • 0 关注
  • 52 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信