-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Closed
Description
After 1.4 gave us the great data-uri, I'd like to see another function in this area: image-size( url, [type]).
The function searches for the image file at url and reads its dimensions.
The (optional) type parameter specifies the return value. Three values should be supported:
- width – Returns the width of the image, including the
pxunit - height – Returns the height of the image, including the
pxunit - size – Returns the height of the image, including the
pxunit (default)
With this I could specify the following code easily:
.logo {
background: url( 'logo.png' ) no-repeat top left;
background-size: image-size( 'logo.png' );
@media ONLY min-device-pixel-ratio: 1.5 {
background-image: url( 'logo@2x.png' );
}
}