没有<a> in ie6</a>的背景

时间:2010-09-23 14:41:58

标签: css internet-explorer-6 background

不知道如何修复它。我试图根据标签的类别制作不同的标识。 html是:

<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;}

如果该类设置为'cat',一切都很好,但如果设置为'cet',我无法在IE6中看到图像。在任何其他浏览器中,背景显示正确。

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

非常感谢您的回答

1 个答案:

答案 0 :(得分: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>)内。