$image-width
プロパティにand$image-height
引数を使用する際に問題がありbackground-size
ます。CSS は、引数を所定の位置に記述することを選択した場合にのみ機能します (以下のコード例のコメント行に見られるように)。動的バージョンは機能しません。私が間違っていることは何ですか?
それに加えて、このコード スニペットは、デバイスで必要な場合にのみ Retina バージョンをロードする必要があります。詳細については、メディア クエリ アセットのダウンロードをご覧ください。
/* see: http://timkadlec.com/2012/04/media-query-asset-downloading-results/ */
@mixin retina-background($filename, $image-width, $image-height, $extension: ".png") {
background-image: image-url($filename + $extension);
height: $image-height;
width: $image-width;
@media only screen and (-webkit-min-device-pixel-ratio: 1.5),
only screen and (min--moz-device-pixel-ratio: 1.5),
only screen and (-o-min-device-pixel-ratio: 3/2),
only screen and (min-device-pixel-ratio: 1.5) {
background-image: image-url($filename + "2x" + $extension);
//background-size: 213px 21px;
background-size: $image-width $image-height;
height: $image-height;
width: $image-width;
}
}