13

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>
web-tiki
  • 99,765
  • 32
  • 217
  • 249
waisie li
  • 343
  • 1
  • 4
  • 15

4 Answers4

8

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>
web-tiki
  • 99,765
  • 32
  • 217
  • 249
3

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.

Community
  • 1
  • 1
Qwertiy
  • 19,681
  • 15
  • 61
  • 128
1

Using Two divs has a better render effect.

div, svg {
  float: left;
  clear: left;
}
p {
  float :left;
}

#div0{
  border-radius: 50%;
  background-color: #fff;
  height: 22px;
  width: 22px;
  border: 1px solid #000;
}

#div1 {
  border-radius: 50%;
  background-color: black;
  height: 24px;
  width: 24px;
}

#div2 {
  border-radius: 50%;
  height: 22px;
  width: 22px;
  background-color: white;
  position: relative;
  top: 1px;
  left: 1px;
}
<div id="div0"></div>
<p>Original</p>

<svg width=26 height=26>
  <circle cx=13 cy=13 r=12 stroke-width=1 stroke=black fill=none />
</svg>
<p>SVG</p>

<div id="div1">
  <div id="div2">
  </div>
</div>
<p>Nested</p>
circusdei
  • 1,967
  • 12
  • 28
1

Try using svg and make a circle a little bigger:

div {
  display: inline-block;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  border: 1px solid black;
}
<svg width=56 height=26>
  <circle cx=13 cy=13 r=12 stroke-width=1 stroke=black fill=none />
  <circle cx=43 cy=13 r=11.5 stroke-width=1 stroke=black fill=none />
</svg>

<div></div>
Qwertiy
  • 19,681
  • 15
  • 61
  • 128