【问题标题】:Issues in Internet Explorer, positioning?Internet Explorer 中的问题,定位?
【发布时间】:2018-05-22 20:39:12
【问题描述】:

在除 Internet Explorer 之外的所有其他浏览器中一切正常,令人惊讶! 蓝色三角形应该使用绝对/相对位置位于框的顶部。正如我所说,它有效,但看起来像 Internet Explorer 中的图片。有谁知道这是造成这个的??? :)

<div class="services">
    <a href="#"> 
        <div class="box redovisning">
            <img class="boxImage" src="../img/accounting_icon.svg" alt="redovisning.png">
            <h3>redovisning</h3>
            <div class="triangle-bottomright"></div>
        </div>
    </a>
    <a href="#"> 
        <div class="box consulting">
            <img src="../img/consulting_icon.svg" alt="consultation.png">
            <h3>rådgivning</h3>
            <div class="triangle-bottomright"></div>
        </div>
    </a>
    <a href="#"> 
        <div class="box revision"> 
            <img class="boxImage" src="../img/revision_icon.svg" alt="revision.png">
            <h3>revision</h3>
            <div class="triangle-bottomright"></div>
        </div>
    </a>
</div>


CSS:
.services {
    width:100%; 
    display: flex; 
    flex-direction: row; 
    justify-content: space-around; 
    flex-wrap:wrap; 
    margin-bottom:40px; 
}
.box {
    position: relative;
    height:300px; 
    width:300px; 
    border: 2px solid $black;  
    display:flex; 
    justify-content:center; 
    flex-direction:column; 
}
.box:hover > .triangle-bottomright {
    border-left: 0 solid transparent;
    right: 0;
}
.box:hover > h3 {
    color:$black; 
}
.consulting img {
    width: 80%;
    height: 211px;
}
.triangle-bottomright {
    transition: all .3s ease-in-out;
    width: 0;
    height: 0;
    right: 0;
    border-bottom: 300px solid $blue;
    border-left: 298px solid transparent;
    z-index: 1; 
    position:absolute; 
}

【问题讨论】:

  • 可能是 flex,不是所有 IE 版本都支持它

标签: css internet-explorer css-position


【解决方案1】:

IE 似乎希望您也为具有绝对定位的元素赋予其最高值。这应该可以解决您的问题:

.triangle-bottomright {
  transition: all .3s ease-in-out;
  width: 0;
  height: 0;
  right: 0;
  top: 0;
  border-bottom: 300px solid $blue;
  border-left: 298px solid transparent;
  z-index: 1; 
  position:absolute; 
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-06-26
    • 2023-03-31
    • 2013-08-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-11-24
    • 1970-01-01
    相关资源
    最近更新 更多