htmlcsssassionic3

Merge hex and opacity


I have CSS class like below. Can I get the one hex value instead of both? In other words, merge both and return hex value.

.my-class{
   background-color: #50A2A7;
   opacity: 0.41;
}

Solution

  • You cannot use HEX value for opacity, you have to switch to RGBA like this :

    background-color: rgba(80, 162, 167, 0.41);