Reputation: 3272
I have a picture as background of a list-element.
I'd like to have a gradient overlaying the background-image of the list-item which should be transparent.
css foreground, overlaying the image should be like this:
.listItem{
background: linear-gradient(white, black);
opacity: 0.2;
}
I can't wrap a div around the list-element, because the framework doesn't accept it.
Upvotes: 0
Views: 172
Reputation: 6116
Demo .. Try this in your CSS
.listItem{
background: linear-gradient(rgba(255, 255, 255, 0), rgba(0, 0, 0, 0.5)), url('http://t0.gstatic.com/images?q=tbn:ANd9GcSEtKrXuUIiURHP7PFGY_cdYDXyuWhilTgWHkJxZRWAt3-tlSy6epfAAFQQ') no-repeat;
background-size: cover;
}
you can use RGBA colors which are much better than using normal colors with opacity
property
Hope this will help you
Upvotes: 2
Reputation: 3571
You can add the image url
at the last
.listItem{
background: linear-gradient(white, black), url('/img/sampleImage.jpg') no-repeat;
}
Upvotes: 1