边缘浏览器

时间:2015-09-15 14:20:59

标签: css microsoft-edge

我在一个固定容器中的div下面有一个意外的1px余量。此问题仅发生在Edge中(可能也在IE中)。经过一些测试,我能够用一个简单的例子来重现这个bug。

这张图片,你可以重现运行下面的片段,由固定div内的3个方格div组成。 Firefox

enter image description here

在Edge中,你可以修复"这个问题可以通过在容器div中禁用属性top: 50%,也可以在其中的div中禁用border-*-right-radius: 6px。当然,这不是一个修复,因为我需要这两个属性来有效地实现这个设计。

我该如何解决这个问题?我尝试添加与背景颜色相同的边框,但背景不是不透明的。

编辑:如果您无法立即在IE / Edge中看到它,请尝试选择容器div并慢慢增加top属性的值。在IE11中,将其从5%更改为6%已经使问题再次明显。



.box {
  background-color: rgba(0,0,0,0.15);
  height: 70px;
  line-height: 70px;
  text-align: center;
  border-right: 1px solid rgba(0,0,0,0.2);
}
.box:hover {
  background-color: rgba(50,50,100,0.15);
}
.box:first-child {
  border-top-right-radius: 6px;
  border-top: 1px solid rgba(0,0,0,0.2);
}
.box:last-child {
  border-bottom-right-radius: 6px;
  border-bottom:1px solid rgba(0,0,0,0.2);
}

.main {
  width: 70px;
  position: fixed;
  left: 0;
  top: 5%;
}

<div class="main">
  <div class="box"></div>
  <div class="box"></div>
  <div class="box"></div>
</div>
&#13;
&#13;
&#13;

2 个答案:

答案 0 :(得分:2)

尝试在父div上使用border:http://jsfiddle.net/gtf0fa8n/1/

父级上的边框半径不会在IE中制作内部div渲染

.main {
    border: 1px solid rgba(0, 0, 0, 0.5);
    border-left: 0;
    border-radius: 0 6px 6px 0;
    overflow: hidden;
}

.box {
    background-color: rgba(0, 0, 0, 0.3);
    height: 70px;
    line-height: 70px;
    text-align: center;
}
.box:hover {
    background-color: rgba(50,50,100,0.15);
}

答案 1 :(得分:1)

只需在底部给出1px的相同颜色的方框图。

box-shadow: #2a2e37 0px 1px 0px;
相关问题