I have created simple circles using border radius 50% but the color of border is fading means color is spread out. How to Solve this ?, I have tried to create border using ::after but that doesn’t work.
Here is my code:
.category-row {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
}
.category-item {
margin-bottom: 10px;
padding: 15px;
}
.image-box {
width: 140px;
height: 140px;
border-radius: 50%;
display: table;
position: relative;
margin: 0 auto 24px;
background: #FBF4F3;
border: 1px solid #AF3D78;
}
.category-title {
text-align: center;
}
<div class="category-row">
<div class="category-item">
<div class="image-box"></div>
<div class="category-title">Fragrance</div>
</div>
<div class="category-item">
<div class="image-box"></div>
<div class="category-title">Fragrance</div>
</div>
<div class="category-item">
<div class="image-box"></div>
<div class="category-title">Fragrance</div>
</div>
<div class="category-item">
<div class="image-box"></div>
<div class="category-title">Fragrance</div>
</div>
<div class="category-item">
<div class="image-box"></div>
<div class="category-title">Fragrance</div>
</div>
I want a smooth border color.
2
Answers
Please open your jsfiddle link on a mobile device and zoom it. It is not fading out. The appearance may be different depending on the resolution and screen size.
Otherwise, you can try increasing the border-width to 2px:
You seem to be having problems with anti-aliasing on the circle’s border. By creating a gradient effect by blending the border and background colors, anti-aliasing is a technique used to soften jagged edges. This occasionally results in the border colour looking faded or dispersed.
Creating the circle border using the outline property rather than the border property is one technique to fix this. Without changing the layout of the element or the content around it, the outline property draws a line outside the element’s border edge.
CSS code: