Html 例如在右下角放置浮动图像

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3075496/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 03:31:46  来源:igfitidea点击:

Putting a floating image in the bottom-right corner for example

htmlcss

提问by Apache

Basically I want to put a transparent image in the bottom-right corner. I read the questions about top-right, right, and so on. However, I can only apply margin-top: 100%;which will put it where I want BUT it shows the scroll bar then and the picture will be really at the bottom, I can't even see it.

基本上我想在右下角放置一个透明图像。我阅读了有关右上角、右边等的问题。但是,我只能申请margin-top: 100%;将它放在我想要的位置,但它会显示滚动条,并且图片将真正位于底部,我什至看不到它。

Any ideas are welcome.

欢迎任何想法。

回答by MvanGeest

Try

尝试

right: 0px;
bottom: 0px;

Of course you'll need fixed positioning:

当然你需要固定的定位:

position: fixed;

This will make it stick to the bottom-right corner wherever the user scrolls.

这将使它粘在用户滚动的右下角。

回答by Kris van der Mast

Do it like:

这样做:

background-image:url('someurl/image.png');
background-position:right bottom;
background-repeat:no-repeat;

Grz, Kris.

格兹,克里斯。