@mixin flag-position($col, $row, $offsetX, $offsetY) { background-position: $col*(-1)*$offsetX $row*(-1)*$offsetY; } @mixin flags-list($width, $height, $bgSize) { background-size: $bgSize; height: $height; width: $width; &.flag-icon-ru { @include flag-position(8, 9, $width, $height); } /* Russia */ &.flag-icon-gb { @include flag-position(4, 12, $width, $height); } /* United Kingdom */ } /* * PNG images */ .flag-icon { background-image: url('/images/flags-sprite.png'); background-position: 1000px 1000px; background-repeat: no-repeat; display: inline-block; position: relative; &.flag-icon-24x16 { @include flags-list(24px, 16px, 360px); } &.flag-icon-15x10 { @include flags-list(15px, 10px, 225px); } }