
To set the opacity level for a <div> element as the below example:
div { opacity: 0.5; }But the following example will let the content inside the <div> become transparent as well.
Instead of using “opacity” to set transparent background-color. You can try using “rgba” function as below.
background-color: rgba(255, 0, 0, 0.5);Now, only the background is transparent.