2010-09-23 41 views
0

不知道如何解决它。我试图根据标签的类别制作不同的标识。的HTML是:在ie6中无<a>的背景

<div id="header"> 
    <a href="/index.php" id="logo" class="cet"> 
     <h1 id="l">title</h1> 
    </a> 
</div> 

和CSS是:

#header { 
    height:204px; 
    background: url(../img/il-01.jpg) no-repeat 400px 2em; 
    position:relative; 
    clear:both; 
} 
#header #logo { 
    display:block; 
    position:absolute; 
    left:2em; 
    top:3em; 
    width:355px; 
    height:107px; 
    overflow:hidden; 
} 
#header #logo.cat { background: url(../img/logo_cat.png) no-repeat -1px top; } 
#header #logo.cet {background: url(../img/logo_cet.png) no-repeat -10px -40px;} 

而且如果类设置为“猫”一切都很好,但如果它被设置为“CET”我不能看图像在IE6中。在任何其他浏览器中,背景显示正确。

背景图像的大小差别不大,它可能是问题吗?

非常感谢你对你的答案

+1

不要使用Internet Explorer 6吗? – Joe 2010-09-23 14:44:30

+0

这是否适用于其他浏览器? – jwueller 2010-09-23 14:47:39

+0

我希望我不能使用IE6,但它是俄罗斯一些政治结构的突发奇想* palmface * – 2010-09-23 14:56:09

回答

4

您不得为background(-positon)混合长度和关键字。旧的CSS版本不允许它,所以旧版浏览器可能不支持它。取而代之的

#header #logo.cat { background: url(../img/logo_cat.png) no-repeat -1px top; } 

使用

#header #logo.cat { background: url(../img/logo_cat.png) no-repeat -1px 0; } 

顺便说一句,你需要检查你的HTML。块元素(如<h1>)可能不在链接内(<a>)。

+0

但是如果我使用混合长度和关键字,就像在'猫'中它在IE6中工作!但'cet'不起作用。 – 2010-09-23 14:52:53

+0

我的意思是,只有2最后是不同的,但'猫'类在IE6中的作品,'cet'不 – 2010-09-23 14:53:57

+0

我不知道你在说什么。 “猫”在你的例子中没有混合的关键字和长度。 – RoToRa 2010-09-23 14:55:35