为什么ie7显示不同于其他浏览器?

时间:2014-10-13 05:25:11

标签: html css internet-explorer

为什么ie7显示与其他浏览器不同?

我想应用此代码在ie7上显示,就像在其他浏览器中一样,我该怎么办?

http://jsfiddle.net/7jvc56dx/

<div style=" width: 94px; height: 94px; float: left; position: relative;">
    <span style="position: absolute; left: 0px; z-index: 999999999; visibility: visible;">
        <div style="top: 0px; z-index: 999999999; left: 99px; opacity: 1;">
            <div style="opacity: 1; 
                        position: relative; 
                        z-index: 999; 
                        float: left;">
                <img src="http://1.bp.blogspot.com/-5h8gctiTlMc/UG2WvFG7mOI/AAAAAAAAA50/RrDakdojI6c/s200/1.png" style=" border: none; width: 200px; height: 200px; ">
            </div>
        </div>        
    </span>
    <span style=" float: left; margin: 7px; width: 80px;">
        <div style=" float: left; height: 80px; ">
            <img border="0" src="http://1.bp.blogspot.com/-5h8gctiTlMc/UG2WvFG7mOI/AAAAAAAAA50/RrDakdojI6c/s200/1.png" width="80" height="80">                
        </div>
    </span>
</div>

<div style=" width: 94px; height: 94px; float: left; position: relative;">
    <span style=" float: left; margin: 7px; width: 80px;">
        <div style=" float: left; height: 80px; ">
            <img border="0" src="http://3.bp.blogspot.com/-n9TEqPspybc/T5K75Hr73PI/AAAAAAAABIM/wq2nrhHeTjk/s200/2.png" width="80" height="80">                
        </div>
    </span>
</div>

<div style=" width: 94px; height: 94px; float: left; position: relative;">
    <span style=" float: left; margin: 7px; width: 80px;">
        <div style=" float: left; height: 80px; ">
            <img border="0" src="http://1.bp.blogspot.com/-NMxRUneaD8w/Tw-X5GqdrBI/AAAAAAAAAR0/6gLbo8Uox4o/s200/3.png" width="80" height="80">                
        </div>
    </span>
</div>

1 个答案:

答案 0 :(得分:1)

  1. 这是一个z索引问题。每个浏览器都有不同的z-index max / min。 (9999999999对于IE7而言太大了)我建议使用小号码...如010100等...

  2. 我还建议让结构更简单:

    <div>
        <img src="1.png" />
    </div>
    <div>
        <img src="2.png" />
    </div>
    etc...
    
  3. 确保使用样式表。您有许多内联样式,必然存在优先级问题。

  4. 示例: jsFiddle链接:http://jsfiddle.net/7jvc56dx/