Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个 div 的位置设置为relative. 但我希望那个 div 贴在屏幕的底部,所以即使你滚动它也会留在那里。我无法将位置更改为fixed,因为对于所述 div 的内容来说这是必需的。
relative
fixed
将父级设置为position: fixed;并将其粘贴到底部,这样您就不需要更改该div position属性。
position: fixed;
div
position
# Example .child { position: relative; } .parent { position: fixed; bottom: 0px; left: 0px; right: 0px; }