Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to make border for half-circle fade out?

I want to make half border of a circle which fades out at the end, like this:
enter image description here

I managed to create a border that fades out to the bottom like this:

#cont{
  background: -webkit-linear-gradient(green, #fff);
  width: 300px;
  height: 300px;
  border-radius: 1000px;
  padding: 10px;
}

#box{
  background: black;
  width: 300px;
  height: 300px;
  border-radius: 1000px;
}
<div id="cont">
  <div id="box"></div>
</div>

However, this circle does not fade out at 50% but on the bottom. Also the border does not become thinner. How can I achieve this?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

I managed to make it using positions. I assume this would give a better understanding on how to make these kind of shapes.

#cont {
  background: -webkit-linear-gradient(green -50%, #fff);
  width: 300px;
  height: 300px;
  border-radius: 100%;
  padding: 10px;
  position: relative;
  top: 0;
  left: 0;
}

#box {
  background: #fff;
  width: 320px;
  height: 320px;
  border-radius: 100%;
  position: absolute;
  top: 2%;
  left: 0.1%;
}
<div id="cont">
  <div id="box"></div>
  <div id="box2"></div>
</div>
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading