So I have seen quite a few ways to darken images with CSS, including ones with rounded corners, but my problem is different.
Let\'s say I have an .png image that loo
Webkit only solution
Quick solution, relies on the -webkit-mask-image property. -webkit-mask-image
sets a mask image for an element.
There are a few gotchas with this method:
:after
psuedo-element (IMG
tags can't have :before
/:after
pseudo elements, grr)attr(…)
CSS function to get the IMG
tag URL, so it's hard-coded into the CSS separately.If you can look past those issues, this might be a possible solution. SVG filters will be even more flexible, and Canvas solutions will be even more flexible and have a wider range of support (SVG doesn't have Android 2.x support).