【发布时间】:2019-04-23 10:17:44
【问题描述】:
- 我正在尝试开发一个粘性页脚。
- 当您点击添加新的体育运动按钮时,一个抽屉会在该页脚中打开并停留在底部。
- 但是当我滚动页面时,页脚向上移动。
- 我尝试了各种职位,但仍然无法正常工作。你能告诉我如何解决它。 -在下面提供我的代码 sn-p、沙箱和屏幕截图。
https://codesandbox.io/s/jp82jl853v
sportsEditTabContentFooter: {
position: "fixed",
left: 0,
bottom: 0,
width: "100 %",
backgroundColor: "red",
color: "white",
textAlign: "center"
},
<div className={classes.sportsEditTabContentFooter}>
<div>sports Status</div>
<div>
<Button variant="outlined" className={classes.button}>
Cancel
</Button>
<Button
variant="outlined"
onClick={this.savesports}
className={classes.button}
>
Save sports test
</Button>
</div>
</div>
【问题讨论】:
-
你试过
position: sticky;吗? -
@gearsdigital 嘿,它成功了,谢谢,你能帮我解决这个问题吗stackoverflow.com/questions/53265169/…
标签: javascript html css reactjs material-ui