Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Border radius makes background image blurry

Why does border-radius makes background image blurry?

example

.orig,
.round,
.container,
.container::before
{
  content: "";
  width: 150px;
  height: 150px;
  background-size: cover;
  background-image: url("https://lh3.googleusercontent.com/IlhDxQVsR17dwwER5xYZJej867KrdSx0K5eyRP2RFP4eQJMD2pi0ZGBhrMOcajBUP9M54lpmIr90JecPUFGPaRe3sDZ82RvHBSw1rw-YJvQs7J8K3g=w1024-h683-n-l50-sg-rj");
  display: inline-block;
  position: relative;
}

.round,
.container
{
  border-radius: 10px;
}

.container
{
  background-image: none;
  overflow: hidden;
}


/* display text */
div::after
{
  content: attr(class);
  position: absolute;
  color: white;
  width: 100%;
  top: 0;
  display: block;
  text-align: center;
}
<div class="orig"></div>
<div class="round"></div>
<div class="container"></div>

Is there some kind of css parameter that can disable this effect?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Try using image-rendering: pixelated on the image. This should tell to browser to display the image with crisp edges, rather than smoothing it out.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading