开发者

How can I create a swimming div

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


use css:

position: fixed

simple as that


Use the position:fixed style on your div. E.g.

<div class="swimming">Content</div>

Css:

.swimming { position:fixed; left:0px; top:0px; }


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)


I believe postion: fixed is the CSS style you want.

<div style="position: fixed; top: 10px; left: 20px; right: 20px; height: 50px">
    content
</div>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜