如何创建游泳 div
我想创建一个 div 作为 Facebook 的聊天栏。我想看到该 div,但是向上或向下滚动窗口。您对此有什么建议吗?
注意:我有 Devexpress aspx 工具许可证。
恰金
I want to create a div as Facebook's chat bar. I want to see that div however scroll the window up or down. Do you have any sugesstions about this?
Note: I have Devexpress aspx tools licence.
Çağın
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
使用CSS:
就这么简单
use css:
simple as that
在您的 div 上使用
position:fixed
样式。例如CSS:
Use the
position:fixed
style on your div. E.g.Css:
正确的答案是使用 CSS
position:fixed;
。但请注意,IE6 不支持
position:fixed;
。这对您来说可能并不重要(剩下的少数 IE6 用户已经习惯了网站被破坏的情况)。更重要的是,许多移动浏览器也不支持
position:fixed;
。对于现代网站来说,这更是一个问题。他们不支持它的原因是因为具有固定位置的元素可能会在较小的屏幕上导致主要的布局问题。他们中的大多数将“固定”视为“绝对”,因此它仍在页面流之外,但可以滚动。请参阅此处了解更多信息:http://www.quirksmode.org/m/css.html - 它有一个表格,显示各种移动浏览器对此功能(和其他功能)的支持。 (但请注意,移动市场正在迅速变化,此表可能不是最新的)
The correct answer is with CSS
position:fixed;
.However, be aware that IE6 doesn't support
position:fixed;
. This may not matter to you (the few remaining IE6 users are used to sites being broken by now).More importantly, many mobile browsers don't support
position:fixed;
either. This is more of an issue for a modern site. The reason they don't support it is because an element that has a fixed position could cause major layout issues on a smaller screen. Most of them treat 'fixed' as 'absolute' so that it is still outside the page flow, but can be scrolled.See here for more info: http://www.quirksmode.org/m/css.html - it's got a table which shows support for this feature (and others) in the various mobile browsers. (but note that the mobile market is changing rapidly and this table may not be bang up to date)
我相信
postion:fixed
是你想要的 CSS 样式。I believe
postion: fixed
is the CSS style you want.