Home >Web Front-end >CSS Tutorial >How to Disable Antialiasing When Scaling Images for Crisp Edges?
How to Disable Antialiasing When Scaling Images
When scaling up images, antialiasing can create a blurred or fuzzy effect on the edges. This can be undesirable in certain situations, such as when you want to maintain sharp and distinct lines.
Fortunately, it is possible to disable antialiasing using CSS, resulting in an image with crisp and defined edges. To achieve this, apply the following style declarations to the image element:
image-rendering: optimizeSpeed; image-rendering: -moz-crisp-edges; image-rendering: -o-crisp-edges; image-rendering: -webkit-optimize-contrast; -ms-interpolation-mode: nearest-neighbor;
This CSS code is cross-browser compatible, including Safari, Chrome, Opera, Firefox, and Internet Explorer. It instructs browsers to render images without applying antialiasing, preserving hard edges.
The above is the detailed content of How to Disable Antialiasing When Scaling Images for Crisp Edges?. For more information, please follow other related articles on the PHP Chinese website!