如何保持背景图像在左下角甚至滚动 [英] How to keep background image on bottom left even scrolling

查看:188
本文介绍了如何保持背景图像在左下角甚至滚动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有一种方法来保持我的背景图像在底部左侧所有的时间,即使用户滚动浏览器。我当前的css可以使图像在浏览器的底部,当网站加载,但如果我滚动浏览器,它将仍然保持在同一位置。我感谢任何帮助。

I was wondering if there is a way to keep my background image on bottom left all the time even if the user scroll the browser. My current css can make the image in the bottom of the browser when the site loaded, but if I scroll the browser, it will still stay in the same location. I appreciate any help.

html, body 
{
background-image:url("backgroundBottom.png");
background-position:bottom left;
background-repeat:no-repeat;
background-attachement:fixed;   //I just add this, don't think this would work.
font-family:"Georgia, self";
font-size:"30px";
margin:0px;
height:100%;
text-align:center;
}


推荐答案

在HTML& BODY元素。

You're setting the background on both the HTML & BODY elements.

代码看起来不错,background-attachment:fixed是你需要的。

The code looks good, background-attachment: fixed is what you need.

简写CSS,只写

body {
    background: url(backgroundBottom.png) bottom left no-repeat fixed;
}

这篇关于如何保持背景图像在左下角甚至滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆