[英]Background image not centred in Firefox7 for Windows
Using Browserlab, it appears that the background image is not centred in Firefox7 for Windows on this site: http://carolineelisa.com/wp/boy/ 使用Browserlab,在以下站点上,背景图像似乎不在Firefox7 for Windows中居中: http ://carolineelisa.com/wp/boy/
The css I am using is below, as is a screenshot. 我正在使用的CSS如下,如屏幕截图所示。
Any ideas how I can fix this? 有什么想法我可以解决这个问题吗?
Thanks! 谢谢!
CSS: CSS:
html {
background: url(images/background.jpg) no-repeat top center #0f0c0b;
}
The first value for the position is the horisontal value, the second is the vertical. 该位置的第一个值是水平值,第二个是垂直值。 So swap
top
and center
: 所以交换
top
和center
:
background: url(images/background.jpg) no-repeat center top #0f0c0b;
Standards reference: http://www.w3.org/TR/css3-background/#ltbg-positiongt 标准参考: http : //www.w3.org/TR/css3-background/#ltbg-positiongt
Your html page background keeps centering itself even if the browser size is < 980px
, but the container aligns itself to the left of the viewport, once the size is lesser. 即使浏览器的尺寸
< 980px
,您的html页面背景也会保持居中< 980px
,但是一旦尺寸变小,容器就会将其自身对齐到视口的左侧。
Now, to address your issue, you should align the html's background to left and top if the width is lesser than 980px. 现在,要解决您的问题,如果宽度小于980像素,则应将html的背景与左侧和顶部对齐。 So, with some responsive css:
因此,使用一些响应式CSS:
@media screen and (max-width: 980px) {
html{
background-position: left top;
}
}
Try this? 尝试这个?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.