如何使DIV总是浮在屏幕右上角? [英] How to make a DIV always float on the screen in top right corner?
本文介绍了如何使DIV总是浮在屏幕右上角?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何让DIV始终浮在屏幕右上角,这样即使我向下滚动页面,DIV仍然显示在相同的固定位置?感谢。
How do I make a DIV always float on the screen's top right corner, so that even when I scroll the page down, the DIV still shows up in the same fixed location? Thanks.
推荐答案
使用 position:fixed
top
和 right
页面两侧:
#fixed-div {
position: fixed;
top: 1em;
right: 1em;
}
IE6不支持 position:fixed
。如果您在IE6中需要此功能,这个纯CSS解决方案似乎可以做到这一点。您将需要一个包装器< div>
来包含一些样式,以便工作,如样式表。
IE6 does not support position: fixed
, however. If you need this functionality in IE6, this purely-CSS solution seems to do the trick. You'll need a wrapper <div>
to contain some of the styles for it to work, as seen in the stylesheet.
这篇关于如何使DIV总是浮在屏幕右上角?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文