:在元素错位之前

时间:2013-07-01 15:45:12

标签: html css cross-browser cross-platform

我不明白为什么它不适用于IE9和IE10。它适用于其他浏览器,但不适用于那些浏览器。这是我的问题:

s http://d.pr/i/QNwi.jpg

.briefing h3 {
    margin-bottom: 23px;
    border-bottom: 3px double #9f9c9b;
    position: relative;
    padding-bottom: 22px;
    padding-left: 40px;
}

.briefing h3:before {
    content: url('../img/general-title-decoration-white.svg?1370978950');
    width: 25px;
    display: block;
    top: 2px;
    left: 0;
    position: absolute;
}

我也在主页上使用这种技术进行字幕装饰。除了它有效:

http://d.pr/i/irsT.jpg

使用此代码:

.special-title {
    font-size: 24px;
    color: #a4a19e;
    line-height: 1.2;
    position: relative;
    padding: 8px 0 8px 38px;
    border-top: 1px solid #e2dbcf;
    border-bottom: 1px solid #e2dbcf;
    margin-top: 49px;
    margin-bottom: 25px;
}

.special-title:before {
    content: url('../img/general-title-decoration.svg?1369571463');
    position: absolute;
    width: 28px;
    height: 28px;
    left: 0;
    top: 10px;
}

我试图看看差异,但我没有得到它。

此外,我在IE上的控制台上没有出现伪元素,因此测试起来有点困难(特别是使用browserstack)。

有什么想法吗?我被困在那里。

Here is the page where the problem appears

And the page where it doesn't

非常感谢你。 :)

2 个答案:

答案 0 :(得分:0)

您是否尝试过定位:before元素absolute? 只要你没有定义display:block;

,它应该没有它就可以正常定位

此外,两种情况之间的区别在于您在第一种情况下设置了display:block;

答案 1 :(得分:0)

我无法对此进行测试,但请尝试使用::before,这在CSS3中显然是新的。