How do you apply a fading overlay to an image in CSS?


Tags: css,image,gradient,fade

Problem :

I have an image inside a div. For example's sake, let's say this div has a background-color of #000. Now, I want this image to fade from the left, to the right.

What I mean is, the first column of pixels should appear to have 100% opacity, whilst the final column of pixels should appear to have 0/1% opacity (the final column of pixels will blend in with the background of the div).

How would I do this purely in CSS? The image will always be 50x50.



Solution :

you could overlay div on top of an image and set gradient for div http://tinkerbin.com/xXJQrgnk


    CSS Howto..

    CSS - how not to scroll parts of the page? [closed]

    How to set CSS3 transition using javascript?

    How to fix maximum width of a div? If contents of that div's exceeds than maximum width, we get scroller?

    How I can make nice looking matrix of buttons with bootstrap 3?

    how to remove backgrount property of a div from css through jQuery? [duplicate]

    How to highlight syntax inside
    tag?

    CSS: how to create a fixed top header with a fixed width

    How to make nav menu fall onto the page?

    How to allow users to set up a color theme?

    How do I get the slide in as you scroll down (CSS Trick) technique to work in Safari?

    JQUERY - Tabs - show all div content in date-filter

    How do I make this menu using only HTML and CSS

    Django - how to collapse forms like in the django admin

    How to automatically compile LESS into CSS on the server?

    How to show blocks for progressbar using CSS

    WebGL: How to make an interactive div (like text input) be drawn on some web gl 3d object and still be interactive?

    CSS: How can I force a display: table-cell box to have a fixed width of 50%?

    How to create new div immediately next to image like on Facebook's news feed on right side of page?

    How to Display a div on mouse-over using jquery ?

    How can I get a relative div to expand to fit its absolute contents?

    How to assign color obtained by CSS gradient generator

    How to make two-coloured stripe using CSS?

    how to select last element in the page?

    How to let the chrome forget the page scroll position?

    How to hide all element on html page except one div using css?

    How to get border width in jQuery/javascript

    CSS: How to center text vertically and horizontally over an image

    How to define the css :focus state in a jQuery selector?

    show different content in multiple css popups

    How can I track down a:hover jquery source?