Concentric circles (Donut SVG style)
Posted: 15 Feb 2022, 14:03
Hi all,
First of all, thank you to this community for giving life to a wonderful place to share & learn about HTML & CSS.
I would like to ask about my HTML /CSS /SVG Code because I can't make it to do what I need; Two concentric circles. The one on the outside is colored and the one on the inside is just white so we achieve a donut-like image.
The resulting image looks concentric but for some reason, the colored "circle" is not 100% round, especially if you make the image smaller in size.
Should I change my approach? Thanks!
First of all, thank you to this community for giving life to a wonderful place to share & learn about HTML & CSS.
I would like to ask about my HTML /CSS /SVG Code because I can't make it to do what I need; Two concentric circles. The one on the outside is colored and the one on the inside is just white so we achieve a donut-like image.
Code: Select all
<head>
<style>
:root{
--fontSize: 30px;
}
.circleBase,
.circleBase {
border-radius: 50%;
}
.circle1 {
width: 100%;
height: 100%;
background: transparent linear-gradient(135deg, #FFF200 0%, #8FE4DE 50%,#8FE4DE 0%) 0% 0% no-repeat padding-box;
}
</style>
</head>
<body>
<div class='circleBase circle1'>
<svg viewBox='0 0 500 500'>
<circle style='fill: white;' cx='250' cy='260' r='230' />
</svg>
</div>
</body>
Should I change my approach? Thanks!