Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Border circle looks blurry

This circle with border looks blurry. Is it possible to fix it and how?

div {
  border-radius: 50%;
  border: 1px solid black;
  height: 22px;
  width: 22px;
  background-color: white;
}
<div></div>
like image 531
waisie li Avatar asked Jan 11 '16 21:01

waisie li


People also ask

Why is my border style not working?

If you've set the shorthand border property in CSS and the border is not showing, the most likely issue is that you did not define the border style. While the border-width and border-color property values can be omitted, the border-style property must be defined. Otherwise, it will not render.

What does border radius do?

The border-radius CSS property rounds the corners of an element's outer border edge. You can set a single radius to make circular corners, or two radii to make elliptical corners.


2 Answers

Using box-shadow with a transparent border seems to make it less blurry too with chrome.
In the following example, the first circle is the original and the second is made with a box-shadow :

div {
  border-radius: 50%;
  border: 1px solid black;
  height: 22px;
  width: 22px;
  background-color: white;
  float:left;
}
div + div{
  width:20px;
  height:20px;
  border-color:transparent;
  box-shadow:0 0 0 1px #000;
  margin:1px 3px;
}
<div></div>
<div></div>
like image 144
web-tiki Avatar answered Nov 08 '22 05:11

web-tiki


Seems like transform: rotate(45deg) helps, but not transform: translateZ(1px) rotate(45deg):

div {
  display: inline-block;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  border: 1px solid black;
}

div + div {
  transform: rotate(45deg);
}

div + div + div {
  transform: rotate(45deg);
  transform: translateZ(1px) rotate(45deg);
}
<div></div> <div></div> <div></div>

Based on this answer.

like image 44
Qwertiy Avatar answered Nov 08 '22 05:11

Qwertiy