【问题标题】:CSS3 PIE multiple backgrounds in IE8 - no repeat-xIE8中的CSS3 PIE多个背景-没有重复-x
【发布时间】:2012-08-02 15:07:16
【问题描述】:

我尝试在 CSS3 PIE 中使用多个背景。它适用于 IE7,但不适用于 IE8。我的意思是在 IE8 中我可以使用 no-repeat、repeat 和 repeat y,但浏览器不会呈现 repeat-x 背景。它是一个错误吗?这是一些代码:

#footer .links li {
    background: url('../images/common/border_dashed.png') repeat-x, 
                url('../images/common/bullet_marker2.png') 9px 17px no-repeat;
    -pie-background: url('_ui/images/common/bullet_marker2.png') 9px 17px no-repeat, 
                     url('_ui/images/common/border_dashed.png') repeat-x;
    behavior: url(PIE.htc);
}

我尝试使用底部/顶部和像素位置。我也在试验 z-index 和 position 值。

【问题讨论】:

  • 绝对听起来可能是一个错误(特别是因为您说 IE7 正在渲染它),尽管我在他们的网站上没有找到有关此类错误的信息。你能在jsfiddle.net 中提供一个测试用例吗?
  • 嗯......我刚刚做了,它有效:jsfiddle.net/rtBGW/38。所以我的代码有问题 - 不知道该怎么做:(。

标签: css image background css3pie background-image


【解决方案1】:

好的,我不知道 ie8 的真正问题是什么,但这里有解决方案。对于 IE7,CSS3 PIE 效果很好,我注意到 IE8 支持 :before :)。所以我用它来添加具有背景和适当尺寸的新块元素。它仍然没有显示,所以经过几分钟的实验,我发现 content: "" 解决了这个问题。这是我针对少数背景的代码(页脚中的顶行和页脚中<li> 之间的行):

.ie8 #footer:before {
    content: "";
    display: block;
    width: inherit;
    height: 10px;
    background: url('../images/common/border_dashed.png') 0 4px repeat-x;
}

.ie8 #footer li {
    position: relative;
}

.ie8 #footer .nav li a:before,
.ie8 #footer .procedures li a:before,
.ie8 #affiliations ul:before {
    content: "";
    position: absolute;
    display: block;
    width: 212px;
    height: 1px;
    background: url('../images/common/border_dashed.png') 0 0 repeat-x;
}

.ie8 #footer .nav li a:before,
.ie8 #footer .procedures li a:before {
    margin: -10px 0 0 -27px;
}

.ie8 #affiliations ul:before {
    margin-top: -5px;
}

【讨论】:

猜你喜欢
  • 2012-11-08
  • 1970-01-01
  • 2023-03-16
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-09-29
  • 2011-07-11
  • 1970-01-01
相关资源
最近更新 更多