将元素对齐到窗口的底部

Xav*_*ier 11 css

我试图使用jQuery计算窗口高度然后将该值应用于DIV(容器div)最后我希望jQuery将元素对齐到页面底部.

<div id="wrapper">
    <div id="element-align">Here is the element i wish to align to the bottom</div>
</div>
Run Code Online (Sandbox Code Playgroud)

Ror*_*san 28

关于你的OP的问题,这可以在CSS中完成:

#element-align {
    position: fixed;
    bottom: 0;
}
Run Code Online (Sandbox Code Playgroud)

如果需要,您还可以向元素添加左/右,但固定定位意味着元素将始终显示在相对于浏览器镶边的相同位置,而不管页面的滚动位置如何.