I have gone through weird problem (for me as a beginner in CSS world). I was trying to have a background-image with a transparent color on top of it. Image was the main page background:
body {
font-family: 'Raleway', 'Open Sans', sans-serif;
font-weight: 400;
line-height: 1.6;
background: rgba(0,0,0,.3) url('..img/image.jpg') no-repeat;
background-size: cover;
min-height: 100vh; }
This didn't work for me. Don't know why?
I checked the dev tools, I added separate background-color and it didn't work as well. I tried to find solution here: Semi-transparent color layer over background-image? and treid proposed solutions. Didn't work for me.
But when I added class to the and created this lines:
.body {
background:
linear-gradient(
rgba(0, 0, 0,.5),
rgba(0, 0, 0,.5)
),
url('../img/bg_image.jpg') no-repeat;
background-size: cover; }
It worked! But I still don't know why?
Is it the specificity problem? Perhaps something different? If there is someone who can ansewer my question (with qucik example) I will be grateful.
So the solution I found myslef is the code above but I don't understand whe previous attempt didn't worked form me.
Cheers, Kamil