Ne Kr Ne Kr - 1 month ago 6
CSS Question

rgba on all pages and element style

I would like to set an overlay on my site:

My Site

When I play around with the color in the inspect window, I can make it work in the element style like this:

element.style {
background-color: rgba(0,0,0,0.4);
}


I tried to add the line
background-color: rgba(0,0,0,0.4);
, in my body css, but it is not working. Should it not be on the body element?

<html>
<head>
</head>
<body>
</body>
</html>

body {
background-color: rgba(0,0,0,0.4);
font-family: 'Source Sans Pro', sans-serif;
font-weight: 300;
letter-spacing: -0.01em;
overflow-x: hidden;
position: relative;
}

Answer

If you're talking about overlaying color on your bg img then the rgba needs to be in the same css block as the img

body {
    background-image: bgimg.jpg;
    background-color: rgba(0,0,0,0.4);
    font-family: 'Source Sans Pro', sans-serif;
    font-weight: 300;
    letter-spacing: -0.01em;
    overflow-x: hidden;
    position: relative;
}
Comments