繁体   English   中英

如何使用 CSS 对齐屏幕底部的元素?

[英]How to align element at the bottom of screen using CSS?

How do I align an element at the bottom of a window (independent of the screen size), BUT it remains in that position such that when the window height is reduced (when a user alters window size) it remains in that exact location and is在 window 中看不见?

我觉得这可能需要的不仅仅是 CSS。 如果是这样,任何人都可以引导我朝着正确的方向前进吗?

<div style="position: fixed; bottom: 0px; left: calc(100vw / 2 - 200px); width: 400px; text-align: center; background-color: #ff0000;">Bottom center text<br />Hello center div</div>
<style> .box { border: 1px solid gray; box-shadow: -9px -10px 10px -10px black; width: 200px; height: 200px; position: absolute; bottom: 10vh; right: 10vw; } </style> <div class="box"></div>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM