Jquery 在100%容器的底部固定一个div,并允许while容器滚动
我有一个100%高度的容器,我想将一个按钮与底部对齐10%,并且仍然允许按钮滚动 以下是我到目前为止所掌握的一些资料: 这是按钮的cssJquery 在100%容器的底部固定一个div,并允许while容器滚动,jquery,html,css,fixed,Jquery,Html,Css,Fixed,我有一个100%高度的容器,我想将一个按钮与底部对齐10%,并且仍然允许按钮滚动 以下是我到目前为止所掌握的一些资料: 这是按钮的css #button { display: inline-block; vertical-align: middle; text-decoration: none; letter-spacing: 3px; bottom:10%; position:fixed; background:red; } 您想在按钮上使用position:ab
#button {
display: inline-block;
vertical-align: middle;
text-decoration: none;
letter-spacing: 3px;
bottom:10%;
position:fixed;
background:red;
}
您想在按钮上使用
position:absolute
,而不是position:fixed
。并确保父容器具有位置:relative
#test1 {
height: calc(100% - 60px);
background:pink;
position: relative;
}
#button {
display: inline-block;
vertical-align: middle;
text-decoration: none;
letter-spacing: 3px;
bottom:10%;
position: absolute;
background:red;
}
每件事都很好,你的问题是什么按钮不滚动,我想将按钮与容器底部对齐,并且仍然允许按钮滚动。应该使你的按钮
绝对而不是固定谢谢,我先试过了,但可能拼写不正确或什么的,我以为我疯了,现在一切正常。谢谢