How to use opacity when not use rgba color in css?

Problem

If i use rgba color i can use like this. background-color=rgba(0,0,0,0.5);. But I am not using RGBA color. I just use background-color:#4D4D4D;. I need this because if i use opacity:0.5 it will effect to all the component of the div. So how can i use opacity with this color code ?

Problem courtesy of: Harshana

Solution

**EDIT: Since the question has been clarified, the answer is you have to use RGBA. Just hit up a site like http://www.rgbtohex.net/hextorgb/ to do the conversion from HEX to RGB.

You entered Hex code: #4D4D4D which converts to the following in RGB: R: 77 G: 77 B: 77


opacity:0.5; should work and has great cross browser support: http://caniuse.com/css-opacity

Solution courtesy of: TunaMaxx

Discussion

There is currently no discussion for this recipe.

This recipe can be found in it's original form on Stack Over Flow.