Currently, I am playing with HTML and CSS and I wanted to make a icon from this image
the image is somewhat like that. I tried adding different shapes of ovals and circles inside the bigger circle but it did not work. For the shaded part, I used a box-shadow in styling it. There are already too many divs in my sample icon. I just want to have it simple and readable.
Here is my HTML structure:
<link rel="stylesheet" href="style.css">
<div class="cont">
<div class="icon2">
<div class="inner-circle"></div>
</div>
</div>
and here is my CSS:
.cont {
width: 190px;
height: 190px;
padding: 20px;
}
.icon2 {
position: relative;
border: 2px solid #353332;
width: 187px;
height: 184px;
border-radius: 50%;
background-color: #fff;
box-shadow: inset 20px 35px #1CAEE3;
transform: rotate(177deg);
}
.inner-circle {
border: 7px solid #353332;
width: 120px;
height: 183px;
background-color: #fff;
border-radius: 50% 50% 50% 49% / 60% 52% 40% 40%;
transform: rotate(240deg);
display: block;
margin: 6px 0px 4px 35px;
border-top: 0;
border-bottom: 0;
border-left: 0;
}
Can you explain me this and how can I come up with a solution to my problem? I’m stuck for hours and I just wanted to try it with pure HTML and CSS and not using photoshop.
3
Answers
You can easily do this with one element and radial-gradient. Simply adjust the percentage used inside the gradient to control the shape:
You can also use
box-shadow
😉demo aside your image:
another example :
you may also draw citrus slices https://codepen.io/gcyrillus/pen/wutEK .
but SVG would be at best here 😉
You could make use of a pseudo element and have an overflow:hidden to hide the rest of the pseudo element’s parts that fall outside of the div’s ‘outer circle’