Html 如何在页面右下角添加固定按钮
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19188211/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to add fixed button to the bottom right of page
提问by Brian Lam
I'm having some trouble adding a fixed button on the bottom of my webpage. Been testing out different numbers with the pixels, but the button hasn't been showing underneath the page on the right.
我在网页底部添加固定按钮时遇到了一些问题。用像素测试了不同的数字,但按钮没有显示在右侧的页面下方。
HTML
HTML
<a href="#head"><img src="upbutton.png" id="fixedbutton"></a>
CSS
CSS
.fixedbutton {
position: fixed;
bottom: 560px;
right: 1000px;
}
回答by chopper
You are specifying .fixedbutton
in your CSS (a class) and specifying the id
on the element itself.
您正在.fixedbutton
CSS(一个类)中指定并id
在元素本身上指定。
Change your CSS to the following, which will select the id
fixedbutton
将您的 CSS 更改为以下内容,这将选择id
固定按钮
#fixedbutton {
position: fixed;
bottom: 0px;
right: 0px;
}