Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/79.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 在100%容器的底部固定一个div,并允许while容器滚动_Jquery_Html_Css_Fixed - Fatal编程技术网

Jquery 在100%容器的底部固定一个div,并允许while容器滚动

Jquery 在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

我有一个100%高度的容器,我想将一个按钮与底部对齐10%,并且仍然允许按钮滚动

以下是我到目前为止所掌握的一些资料:

这是按钮的css

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

每件事都很好,你的问题是什么按钮不滚动,我想将按钮与容器底部对齐,并且仍然允许按钮滚动。应该使你的按钮
绝对
而不是
固定
谢谢,我先试过了,但可能拼写不正确或什么的,我以为我疯了,现在一切正常。谢谢