-2

I want to apply gradient overlay to a lot of images just like myspace did in their new design . All the images have a title with black gradient background .

I searched but most of the tutorials are shown using a background image on a div . I want to apply this property to all the <img> tags appearing on my page.

Here's the closest tutorial I found in terms of what I want to achieve . But this is also explained using a background image.

enter image description here

If you look at the background of the title. The black background ensures that the text is clear enough .

Can you please help me out in writing a general css for achieveing this on all images ?

Mj1992
  • 3,404
  • 13
  • 63
  • 102

1 Answers1

0

You should really put more effort into trying it out first.. I found this interesting so I got you started.. http://jsfiddle.net/MpmNc/1/

.overlay {
    content: 'test';
    width: 100%;
    height: 100%;
    background-color: rgba(100,255,50,0.5);
    position: absolute;
    top: 0;
}

.overlay-wrap {
    display: inline-block;
    position: relative;
}

Unfortunately it doesnt seem like css alone will suffice Does :before not work on img elements?

For your gradient: http://www.colorzilla.com/gradient-editor/

Community
  • 1
  • 1
RyanS
  • 3,964
  • 3
  • 23
  • 37