Created
October 3, 2024 05:47
-
-
Save AlvisonHunterArnuero/a7779e09f2db4f3f63b2268e68c0c1a4 to your computer and use it in GitHub Desktop.
Set the background image of a body of a html page to 50%, using pseudo-element ::before and the opacity: 0.5; property
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body::before { | |
content: ""; | |
position: absolute; | |
top: 0; | |
left: 0; | |
right: 0; | |
bottom: 0; | |
background-image: url('place-your-image-url-here.jpg'); | |
background-size: cover; | |
background-position: center; | |
opacity: 0.5; | |
z-index: -1; | |
} | |
body * { | |
position: relative; | |
z-index: 1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment