我正在构建一个将从屏幕底部滑出的东西。我不知道它的高度。
如果我知道我能做到的高度
position: fixed;
bottom: -200px //height of object
我使用 css-animations 将它滑出,它会滑到 bottom: 0
因此我也不能使用 top: 100%;
来隐藏对象.还有其他选择吗?
最佳答案
这是我提出的解决方案。使用 translateY 移动它。
CSS
.slidingthing {
position: fixed;
top: 100%;
/* or margin-top in your case?
margin-top: 100% */
height: 100px; // or whatever
width: 100px; // or whatever
transform: translateY(-100%); // add other browser vendor prefixes
}
fiddle : http://jsfiddle.net/vKW65/4/
关于css - 是否可以在屏幕边框下方修复高度未知的元素?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23510907/