How to prevent the background image from getting blurry

三世轮回 提交于 2019-11-29 02:26:14

Try to add:

image-rendering: -webkit-optimize-contrast;

Nurealam Sabbir

Try adding this to the code: image-rendering: pixelated; For me it worked perfectly. you can also try - image-rendering: -webkit-optimize-contrast;

use of background-size: cover;background-position:50% 50%; will help you..

* {
font-family: Calibri, Comic Sans MS, Serif;
background: #ff0000 url(http://www.coolguysite.co.uk/blog/templates/default/img/rain.jpg)   top center repeat-y;
background-size: cover;
background-position:50% 50%;
}

UPDATED FIDDLE

Josh Keighley

I got it by doing:

background: transparent;

to the h2 and p elements.

Here's the cross browser technique:

 image-rendering: crisp-edges;
 image-rendering: -moz-crisp-edges;          /* Firefox */
 image-rendering: -o-crisp-edges;            /* Opera */
 image-rendering: -webkit-optimize-contrast; /* Webkit (non-standard naming)*/
 -ms-interpolation-mode: nearest-neighbor;   /* IE (non-standard property) */

You can use image-rendering: pixelated. Here is an example from the Mozilla Developer Network:

.pixelated {
  image-rendering: pixelated;
  -ms-interpolation-mode: nearest-neighbor;
}

https://developer.mozilla.org/en-US/docs/Web/CSS/image-rendering

https://jsfiddle.net/9dtj2wkq/

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!