0

何らかの奇妙な理由で背景画像が IE に表示されません。background-image の代わりに background のみを使用し、png、gif、jpg を使用し、画像パスを引用符と二重引用符で囲んで、画像へのフル パスを使用しようとしました。基本的に、IEの背景画像に関してネット上で提案されているすべてを試しました

html, body {
margin: 0;
padding: 0;
width: 1008px;
margin: 0 auto; 
font-family:"Trebuchet MS";
font-size:14px;
line-height: 190%;
text-align:left;
text-decoration: italic;
background-image: url(../images/bgr_top.jpg), url(../images/bgr_bottom.jpg);
background-repeat: repeat-x, repeat-x;
background-position:center top, center bottom;
}

私が持っている唯一の疑いは、ページの上部と下部に 1 つずつ、2 つの画像を使用していることです。閉じ括弧の後のスペースについても読んでください。ただし、別の行で background-repeat: を使用しているため、関連性があるかどうかはわかりません。

他の提案は大歓迎です:)

4

3 に答える 3

0

私の問題をどのように修正したかをお知らせしたかっただけです。Web サイト全体を保持する追加の div を追加し、上部の画像を html に追加し、下部の画像を css の本文に追加しました。

html {
    background: url("../images/bgr_top.jpg");background-repeat: repeat-x; background-position:center top;
    height: 100%;
}

body{
background: url("../images/bgr_bottom.jpg"); background-repeat: repeat-x; background-position:center bottom;

    margin: 0;
    padding: 0;
    margin: 0 auto; 
    font-family:"Trebuchet MS";
    font-size:14px;
    line-height: 190%;
    text-align:left;
     text-decoration: italic;

}

.main {
    margin: 0;
    padding: 0;
    width: 1008px;
    margin: 0 auto; 
    font-family:"Trebuchet MS";
    font-size:14px;
    line-height: 190%;
    text-align:left;
     text-decoration: italic;

}

結果 IE7、8などを含むすべてのブラウザで2つの背景があります

これが誰かに役立つことを願っています。

于 2013-09-15T13:54:11.253 に答える