html{
background: url('web-design.jpg') no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
I am using this CSS above to display a background image for my web page. However, the image is a little in the way of the text that I want to display on the webpage.
If I change its opacity, however, all will be fine. I tried using the opacity : 0.5 in the above CSS but that did not help. How can I change the opacity of this background image ?
What I also tried was making a wrapper <div> and setting its background image and opacity. That did not help, either.
My html:
<body>
<div class="parent">
<div class="content">
<p id="dollar">$</p>
<p id="name">variableName</p>
<p id="equals"> = </p>
<p id="value"> someValue </p>
</div>
</div>
</body>
My css:
@font-face{
font-family: "RobotoCondensed-Regular";
src : url("RobotoCondensed-Regular.ttf");
}
body, html{
height : 100%;
}
body:after{
z-index:-1;
background: url('web-design.jpg') no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
position: absolute;
left:0;
top:0;
right:0;
bottom:0;
opacity:1;
}
.parent{
height : 100%;
display : flex;
display : -webkit-flex;
display : -moz-flex;
display : -o-flex;
align-items: center;
justify-content: center;
}
.content{
display : flex;
display : -webkit-flex;
display : -moz-flex;
display : -o-flex;
align-items: center;
justify-content: center;
background-color : rgba(,,,0.5);
border-radius : 10%;
}
p{
font-family : "RobotoCondensed-Regular";
font-size : 32px;
}