+ 4
Background of a webpage
I need help with something, I want to put opacity in the background of a webpage (which is an image) without affect the whole body, only the image. How can I do? Thank you !
6 odpowiedzi
+ 4
body {
font-family:Blippo, fantasy;
background: url(https://images.unsplash.com/photo-1534438327276-14e5300c3a48?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&w=1000&q=80);
color:black;
font-size:18px;
}
+ 4
I put that Code, but when I put the opacity It affects the text that I have and i want to affect only the image
+ 3
I'm also a beginner in html, but here is how I would do it:
HTML code:
<div id="background-image"></div>
CSS code:
html, body {
width: 100%; height: 100%;
}
#background-image {
position: fixed;
z-index: -1;
width: 100%; height: 100%;
background-image: (path to image);
opacity: (your opacity);
}
+ 2
How did you do it ? Post your code here so we can correct it