Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get rid of the thin white outline on the upper half of this circle?

Tags:

html

css

I can't seem to get rid of the thin white outline on the upper half of this circle. Any ideas on how to fix it? JSFiddle Demo

body {
        background-color: black;
        padding:50px;
    }
    .square {
        background-color: white;
        margin-bottom: 20px;
        height: 200px;
		width: 200px;
		overflow: hidden;
		}
    .halfSquare {
		background-color: #462a04;
		height: 100px;
		width: 200px;
		}
    .circle {
	    background-color: white;
		height: 200px;
		width: 200px;
		border-radius: 50%;
		overflow: hidden;
		}
    .halfCircle {
		background-color: #462a04;
		height: 100px;
		width: 200px;
		}
<body>
  <div class="square"><div class="halfSquare"></div></div>
  <div class="circle"><div class="halfCircle"></div></div>	
</body>
like image 935
NewsletterPoll Avatar asked May 20 '15 22:05

NewsletterPoll


Video Answer


1 Answers

You're seeing this because the containing div .circle has a white background, which is leaking through. You can fix this by removing the background on the containing div and adding a second div for the white semi circle:

<div class="square"><div class="halfSquare"></div></div>
<div class="circle">
     <div class="halfCircle"></div>
     <div class="halfCircle2">
</div></div>

.circle {
    height: 200px;
    width: 200px;
    border-radius: 50%;
    overflow: hidden;
}
.halfCircle {
    background-color: #462a04;
    height: 100px;
    width: 200px;
}
.halfCircle2 {
    background-color: white;
    height: 100px;
    width: 200px;
}

https://jsfiddle.net/v9bLfkpx/1/

Before:

enter image description here

After:

enter image description here

like image 75
garryp Avatar answered Oct 01 '22 01:10

garryp