背景图像不会居中在IE 9中 [英] Background Image won't center in IE 9

查看:78
本文介绍了背景图像不会居中在IE 9中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在每个网页上制作一个带有背景图片的网站。图片以Chrome,Safari,Firefox为中心...但它不会集中在IE 9(不确定IE的其他版本)。



这里是CSS:

  #page {
background-image:url(images / mountain2.jpg);
text-align:center;
margin-top:-50px;
margin-right:auto;
margin-left:auto;
background-repeat:no-repeat;
background-color:#6C86FF;
width:1292;
height:972;
}

(#页,是整个网站的div标记。 p>

帮助,非常感谢。 =)

解决方案

您尝试设置 background-position:center center;


I'm making a site with a background image on every page. The image is centered in Chrome, Safari, Firefox... But it won't center in IE 9 (not sure about the other versions of IE).

Here's the CSS:

#page {
    background-image: url(images/mountain2.jpg);
    text-align: center;
    margin-top: -50px;
    margin-right: auto;
    margin-left: auto;
    background-repeat: no-repeat;
    background-color: #6C86FF;
    width:1292;
    height:972;
}

(#page, is the div tag for the entire site.)

Help, is very much appreciated. =)

解决方案

Have you tried setting background-position: center center;?

这篇关于背景图像不会居中在IE 9中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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