Retina Display: Unterschied zwischen den Versionen
Erscheinungsbild
Die Seite wurde neu angelegt: „==CSS== →for low resolution display: .image { background-image: url(/path/to/my/lowreslogo.png); background-size: 200px 300px; height: 300px; …“ |
K Frederick verschob die Seite Retina Dislpay nach Retina Display: Tippfehler |
||
| (2 dazwischenliegende Versionen von einem anderen Benutzer werden nicht angezeigt) | |||
| Zeile 1: | Zeile 1: | ||
==CSS== | ==CSS== | ||
/* for low resolution display */ | <syntaxhighlight lang="CSS" line start="1" highlight="5" enclose="div"> | ||
.image { | /* for low resolution display */ | ||
.image { | |||
background-image: url(/path/to/my/lowreslogo.png); | background-image: url(/path/to/my/lowreslogo.png); | ||
background-size: 200px 300px; | background-size: 200px 300px; | ||
height: 300px; | height: 300px; | ||
width: 200px; | width: 200px; | ||
} | } | ||
/* for high resolution display */ | /* for high resolution display */ | ||
@media only screen and (min--moz-device-pixel-ratio: 2), | @media only screen and (min--moz-device-pixel-ratio: 2), | ||
only screen and (-o-min-device-pixel-ratio: 2/1), | only screen and (-o-min-device-pixel-ratio: 2/1), | ||
only screen and (-webkit-min-device-pixel-ratio: 2), | only screen and (-webkit-min-device-pixel-ratio: 2), | ||
only screen and (min-device-pixel-ratio: 2) { | only screen and (min-device-pixel-ratio: 2) { | ||
.image { | .image { | ||
background: url(/path/to/my/highreslogo.png) no-repeat; | background: url(/path/to/my/highreslogo.png) no-repeat; | ||
background-size: 200px 400px; | background-size: 200px 400px; | ||
/* rest of your styles... */ | /* rest of your styles... */ | ||
} | } | ||
} | } | ||
</syntaxhighlight> | |||
==Javascript== | ==Javascript== | ||
<syntaxhighlight lang="JAVA" line start="1" highlight="5" enclose="div"> | |||
/* for low resolution display */ | /* for low resolution display */ | ||
.image { | .image { | ||
background-image: url(/path/to/my/lowreslogo.png); | |||
background-size: 200px 300px; | |||
height: 300px; | |||
width: 200px; | |||
} | } | ||
/* for high resolution display */ | /* for high resolution display */ | ||
| Zeile 33: | Zeile 36: | ||
only screen and (min-device-pixel-ratio: 2) { | only screen and (min-device-pixel-ratio: 2) { | ||
.image { | .image { | ||
background: url(/path/to/my/highreslogo.png) no-repeat; | |||
background-size: 200px 400px; | |||
/* rest of your styles... */ | /* rest of your styles... */ | ||
} | } | ||
} | } | ||
</syntaxhighlight> | |||
Aktuelle Version vom 21. September 2015, 21:12 Uhr
CSS
/* for low resolution display */
.image {
background-image: url(/path/to/my/lowreslogo.png);
background-size: 200px 300px;
height: 300px;
width: 200px;
}
/* for high resolution display */
@media only screen and (min--moz-device-pixel-ratio: 2),
only screen and (-o-min-device-pixel-ratio: 2/1),
only screen and (-webkit-min-device-pixel-ratio: 2),
only screen and (min-device-pixel-ratio: 2) {
.image {
background: url(/path/to/my/highreslogo.png) no-repeat;
background-size: 200px 400px;
/* rest of your styles... */
}
}
Javascript
/* for low resolution display */
.image {
background-image: url(/path/to/my/lowreslogo.png);
background-size: 200px 300px;
height: 300px;
width: 200px;
}
/* for high resolution display */
@media only screen and (min--moz-device-pixel-ratio: 2),
only screen and (-o-min-device-pixel-ratio: 2/1),
only screen and (-webkit-min-device-pixel-ratio: 2),
only screen and (min-device-pixel-ratio: 2) {
.image {
background: url(/path/to/my/highreslogo.png) no-repeat;
background-size: 200px 400px;
/* rest of your styles... */
}
}