To incorporate transparency into your background color, you must first convert the hex value to an RGB value and then utilize the rgba()
function. There are several online tools available that allow you to easily convert between hex and rgb, such as this particular one.
Once you have obtained the rgb value, you can apply it along with your desired opacity level using the rgba()
function.
.my-class{
background-color: rgba(80, 162, 167, 0.41);
}
div {
height: 50px;
margin-bottom: 20px;
}
.class1 {
background-color: #50A2A7;
opacity: 0.41;
}
.class2 {
background-color: rgba(80, 162, 167, 0.41);
}
<div class="class1"></div>
<div class="class2"></div>