如何使按钮始终显示在页面上? [英] How to make button always present on the page?
问题描述
伙计们,我确定已经存在,但我不是用正确的方式在Google上工作,对此感到抱歉.
我需要一个简单的脚本,在页面的侧面,只要用户滚动页面,该按钮就会一直存在.
我知道该怎么做,但我只是不知道如何使该按钮/链接始终存在.
有任何想法吗?
Guys I''m sure that already exists, but I''m not google in the right way, sorry for that.
I need a simple script where in the side of the page there is a button that is always present as long as user scroll the page.
I know how to do the "go to bottom" thing, I just dont know how to make that button/link always present.
Any idea?
推荐答案
使用样式位置&将其设置为固定"
例如:
use the style position & set it to ''fixed''
eg:
<div style="removed:fixed;">
Your content
</div>
也请使用左侧的&顶部样式元素将其放置在页面中
==已编辑==
使用位置:固定.显示为已移除:已在上面修复.不知道为什么
Also use the left & top style elements to position it in the page
== edited ==
use position:fixed. It''s shown as removed:fixed above. Don''t know why
它有效.将这段文字保存到html文件&检查
It works. Save this piece of text to a html file & check
<html>
<body>
<div style="position:fixed; left:20px; top:20px; background-color:#ff4;">
Fixed element<br/>
</div>
<div style="height:1000px;"></div>
</body>
</html>
我已经在Firefox 3.6.2中检查过此内容
但是,它在IE6中不起作用. IE 7及更高版本仅当您打开了标准兼容模式(包括DOCTYPE)时,8才支持它. //www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
I''ve checked this in Firefox 3.6.2
However, it will not work in IE6. IE 7 & 8 supports it only if you have turned on standards compliant mode (when you include the DOCTYPE ) like
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
这篇关于如何使按钮始终显示在页面上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!