对于IE8,无法在css中拉伸100%div背景图像

时间:2013-10-29 10:55:15

标签: html css

我有一个网站顶部的背景图片,它不会一直延伸到Internet Explorer 8.已经查看了许多解决方案,但没有一个适合我。提前谢谢。

  <div id="header_combined">
  <img  align="left"  src="/1.images/others/logo/logo4.gif" alt="my logo"  />
  My site

  <strong>  Ltd.</strong>
  <p>"Some more text here"</p>
  </div>

CSS

 #header_combined {

 background-size: 100%;
 Width:100%;
 float:left;
 font-size: 300%; font-weight:bold; font-style:italic;color: #E1012F; text-align:left ;
    font-family:Georgia, "Times New Roman", Times, serif; vertical-align:middle;
    text-shadow: white 0.1em 0.1em 0.2em
 padding-left:15em;
 background-repeat:no-repeat;
 background-image:url('/1.images/others/logo/combined logo2.jpg');

 }
 #header_combined strong {
 color: black;
 text-shadow: white 0.1em 0.1em 0.2em;
    }
 #header_combined p {
 color: red;
 font-size: 0.3em;
 font-style:italic;
    }

4 个答案:

答案 0 :(得分:2)

那是因为background-size是一个CSS3属性,在IE9之前是isn't supported

然而,有一个线程建议可能的解决方法: How do I make background-size work in IE?

您尝试使用top set alpha filter属性:

filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(
src='images/logo.gif',
sizingMethod='scale');

-ms-filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader(
src='images/logo.gif',
sizingMethod='scale')";

There is a nice discussion on this problem

答案 1 :(得分:0)

您想要展示哪些徽标图片?

尝试

.img {
    width: 100%;
}

答案 2 :(得分:0)

怎么样:

  

#header_combined img {width:100%; }

答案 3 :(得分:0)

的CSS:

    .bg {
    background-position: left center;
    height: 102%;
    position: fixed;
    width: 100%;
}

HTML:

<img class="bg" src="artist-bg4.jpg" alt="">

<body>标记

下添加html代码