I'm trying to apply a transparent black color to a background image to avoid strong or flashy colors.
No need to edit the image with any special program.
I have tried to apply this style:
background-color: rgba(0,0,0,0.8);
But I have not been successful.
How do I get the background image to apply a transparent black color, like a layer.
#image {
background-color: rgba(0,0,0,0.8);
background-image:url(http://www.gelfuzion.com/img/slides/nivo/bg-1.jpg);
height: 500px;
max-width: 100%;
}
<div id="image"></div>
One possibility would be to use CSS filters to change the contrast/brightness of the image. If you put a luminosity between 0 and 1 the image will look darker. Something like this example:
::before
Another option could be to use the o pseudo-elements::after
to put a semi-transparent layer on top of the image and thereby make it look darker. For example:You can work with filter
You get it with linear-gradient in the background-image:
If you don't quite understand it well, you can follow this short youtube tutorial:
https://www.youtube.com/watch?v=ASgmfNvCQRg
You can apply something similar to this:
source: http://www.w3schools.com/css/tryit.asp?filename=trycss_image_opacity
All the codes presented are used for the subject in question, unfortunately it does not only affect the background image, but also the fonts.
In my case, I prefer to edit the photo :/ it's more work, but more reliable.