I have a form and I need to add the background with opacity to that. Unfortunately opacity takes the form as well. How to remove opacity from the form and have it only for background?
.container {
width: 100%;
height: 100%;
position: fixed;
visibility: visible;
display: block;
background-color: green;
top: 0;
left: 0;
opacity: 0.5;
}
.form {
width: 150px;
height: 200px;
background-color: blue;
display: flex;
flex-direction: column;
justify-content: center;
color: black;
align-items: center;
margin: 0 auto;
margin-top: 10px;
border-radius: 8px;
z-index: 2;
opacity: 1;
}
<div class="container">
<div class="form">
<p>text</p>
<p>text</p>
<p>text</p>
</div>
</div>
Hi if your background does not has any Images. Then easily you can apply opacity on it background. Here is some example you can use ->
background-color: #00ff0055;
/*-- The value after six digit is your alpha color or opacity of background.--*/
background-color: #0f05; /*-- Same as previous one.--*/
background-color: rgba(0,255,0,.5); /*-- a extend for alpha color--*/
Hope this help you.