You can make some cool tricks using a 24 bit PNG, which has a gradient from opaque to completely transparent. Elements sliding beneath this PNG will appear to disappear whilst fading.
Is this possible using CSS only with Google Chrome? I only have to target this browser.
I'd like to avoid a slice of 1px tall elements with varying opacity
set.
Thanks
Yes it can, just use a
-webkit-gradient
with Alpha values as the background image:And if you are just targeting Chrome, you can also use
:before
and:after
to add the gradients if you wanted to. Here is a quick example. You can view it live on CSSDesk (This method works in a lot more than Chrome, but breaks in FF 3.0 and just doesn't work in a number of IE versions) :