Skip to content

Instantly share code, notes, and snippets.

@carlos-sanchez
Created November 16, 2013 02:59
Show Gist options
  • Save carlos-sanchez/7495377 to your computer and use it in GitHub Desktop.
Save carlos-sanchez/7495377 to your computer and use it in GitHub Desktop.
Tinted images with multiple backgrounds. Instead of using a transparent flood color using rgba() or hsla(), we can use a gradient. Gradients are technically background-images and thus not subject to the rule where they can't come first (be top) in the stacking order.
/* Working method */
.tinted-image {
background:
/* top, transparent red, faked with gradient */
linear-gradient(
rgba(255, 0, 0, 0.45),
rgba(255, 0, 0, 0.45)
),
/* bottom, image */
url(image.jpg);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment