简体   繁体   English

Divs在彼此的顶部,底部div边缘显示。

[英]Divs on top of each other, bottom div edge showing.

I made this sorta simple circular loader-thingy , whith two half circles covered with another two half circles that are positioned right on top of them. 我做了这个简单的圆形装载机 ,其中两个半圈覆盖着另外两个半圈,它们位于它们的正上方。 The covers rotate and reveal the bottom circles to make it look like a circular loading bar. 盖子旋转并露出底部圆圈,使其看起来像圆形装载杆。

The problem is that the edge of the bottom circles are visible in some browsers, and there are some mobile browser issues with that as well. 问题是底部圆圈的边缘在某些浏览器中是可见的,并且还存在一些移动浏览器问题。 Is there a solution for this? 这有解决方案吗?

CSS CSS

.wrap{
    position:relative;
    width:100px;
    height:100px;
    overflow:hidden;
    border-radius:50px;
}
.circle{
    position:absolute;
    top:0;
    width:50px;
    height:100px;
    background:black;
}
.cover{
    position:absolute;
    left:0;
    width:50px;
    height:100px;
    background:white;
}
.halfcircleleft{
    width:50px;
    position:absolute;
    top:0;
    left:0;
}
.halfcircleleft .circle{
    z-index:3;
    border-radius:50px 0 0 50px;
}
.halfcircleleft .cover{
    z-index:4;
    border-radius:50px 0 0 50px;
}

HTML HTML

<div class="wrap">
    <div class="halfcircleleft">
        <div class="circle"></div>
        <div class="cover"></div>
    </div>

    <div class="halfcircleright">
        <div class="circle"></div>
        <div class="cover"></div>
    </div>
</div>

what about using a circle with transparent background and white border bigger than hole to put it over the border you want to remove?like: 如何使用透明背景和白色边框大于hole的圆圈将其放在要删除的边框上?如:

.hole, .hole2{
    z-index:99;
    position:absolute;
    width:86px;
    height:86px;
    top:7px;
    left:7px;
    background:lightgrey;
    border-radius:50%;
    text-align:center;
    line-height:86px;
    font-family:Arial;
    font-size:38px;
    padding-right:2px;
}
.hole2 {
    background:transparent;
    border:4px solid white;
    width:106px;
    height:106px;
    top:-3px;
    left:-3px;
}

then just remove the overflow:hidden of wrap which it's not doing anything (at least in your example) 然后只是删除overflow:hiddenwrap ,它没有做任何事情(至少在你的例子中)

JSFIDDLE 的jsfiddle

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

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