简体   繁体   English

Internet Explorer中的问题,定位?

[英]Issues in Internet Explorer, positioning?

Everything works fine in all other browsers than Internet Explorer, suprise! 在Internet Explorer以外的所有其他浏览器上,一切正常,请注意! The blue triangle is supposed to be on top of the box using position absolute/relative. 使用绝对/相对位置,蓝色三角形应该位于框的顶部。 And as i said it works but looks like in the picture in Internet explorer. 正如我所说的那样,但它看起来像Internet Explorer中的图片。 Does anyone know thats causing this??? 有谁知道那是造成这种情况的原因??? :) :)

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

蓝色三角形应该在盒子的顶部。但是不,不是在IE中

It seems that IE expects you to give it the top value also for an element with absolute positioning. IE似乎希望您也为具有绝对定位的元素赋予它最高价值。 This should solve your problem: 这应该可以解决您的问题:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM