Reputation: 23
this is my first post!
I have the following need:
<section>
it will be applied to is of 100% width and content dependent heightThe code I have so far looks a bit like this:
section.funky-background {
@include background(
radial-gradient($warmRadialGradient, top right),
image-url($darkTexture)
);
@include hidpi {
@include background(
radial-gradient($warmRadialGradient, top right),
image-url($darkTextureHiDpi)
);
}
without a background-size
property this simply displays the larger $darkTextureHiDpi image at the same lower resolution. However adding a background-size
property causes the whole background to display at the specified size and thus tile in an undesired way.
@include hidpi {
@include background(
radial-gradient($warmRadialGradient, top right),
image-url($darkTextureHiDpi)
);
background-size: 200px 200px; // $darkTextureHiDpi is 400x400px
}
My question: is there a way to define the size of the background-image png without affecting the layers above it (in this case the radial gradient)?
Upvotes: 0
Views: 501
Reputation: 68329
All of the background properties accept a list, not just the shorthand. Assuming the first image shouldn't be resized but the 2nd should, this is what it would look like:
@include hidpi {
@include background(
radial-gradient($warmRadialGradient, top right),
image-url($darkTextureHiDpi)
);
background-size: auto auto, 200px 200px; // $darkTextureHiDpi is 400x400px
}
Upvotes: 1