简体   繁体   English

如何将图片保留在html中,以使其不会与页面的其余部分一起移动?

[英]How do I keep an image in html to not move with the rest of the page?

Is it possible to keep an image from moving while the user scrolls through a web page. 当用户滚动浏览网页时,是否可以防止图像移动。 like the user always sees the image? 像用户总是看到图像? I'd imagine it'd be possible using a but I don't know how. 我以为有可能使用a,但我不知道如何。

Use the css position: fixed; 使用css position: fixed; attribute, specifying top and left absolute attributes. 属性,指定topleft绝对属性。

body {
  background-image: url("http://yoursite.com/path/to/image.gif");
  background-position: 50% 50%;
  background-repeat: no-repeat;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM