Propriété de rendu d'image CSS
Exemple
Montrez les différents algorithmes qui peuvent être utilisés pour la mise à l'échelle de l'image :
.image {
height: 100px;
width: 100px;
image-rendering: auto;
}
.crisp-edges {
image-rendering: -webkit-optimize-contrast;
image-rendering: crisp-edges;
}
.pixelated {
image-rendering: pixelated;
}
.smooth {
image-rendering: smooth;
}
.high-quality {
image-rendering: high-quality;
}
Définition et utilisation
La image-rendering
propriété spécifie le type d'algorithme à utiliser pour la mise à l'échelle de l'image.
Remarque : Cette propriété n'a aucun effet sur les images qui ne sont pas mises à l'échelle.
Valeur par défaut: | auto |
---|---|
Hérité: | Oui |
Animable : | non. En savoir plus sur l'animation |
Version: | CSS3 |
Syntaxe JJavaScript : | objet .style.imageRendering="pixelated" |
Prise en charge du navigateur
Les nombres dans le tableau indiquent la première version du navigateur qui prend entièrement en charge la propriété.
Property | |||||
---|---|---|---|---|---|
image-rendering | 41.0 | 79.0 | 65.0 | 10.0 | 28.0 |
Chrome, Edge, Opera et Safari utilisent un autre nom pour la
crisp-edges
valeur : -webkit-optimize-contrast
.
Syntaxe CSS
image-rendering: auto|smooth|high-quality|crisp-edges|pixelated|initial|inherit;
Valeurs de propriété
Value | Description |
---|---|
auto | Let the browser choose the scaling algorithm. This is default |
smooth | Use an algorithm that smooth out the colors in the image |
high-quality | Same as smooth, but with a preference for higher-quality scaling |
crisp-edges | Use an algorithm that will preserve the contrast and edges in the image |
pixelated | If the image is scaled up, the nearest-neighbor algorithm is used, so the image will appear as being composed of large pixels. If the image is scaled down, it will be the same as auto |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |