Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Text opacity in CSS

Tags:

css

Is there any way I could treat text inside of a wordpress widget, to make it semi transparent using an opacity funcion? Only limiting myself to the content of the following code block.

#content .widget .caption h3 {
color:#000000;
font-family:'Overlock';
margin:0 -10px;
padding:0 10px;
font-size:27px;
height:46px;
line-height:46px;
font-weight:bold;

}

With the option below, the entire widget will be treated as transparent.

 #content .widget .caption h3 {
color:#000000;
font-family:'Overlock';
margin:0 -10px;
padding:0 10px;
font-size:27px;
height:46px;
line-height:46px;
font-weight:bold;
opacity:0.2;

}

I only want the to have its opacity changed. Is it even possible that way?

like image 387
Mikolaj Marcisz Avatar asked Jan 12 '23 16:01

Mikolaj Marcisz


2 Answers

You can use rgba as the color attribute like this:

color: rgba(0,0,0,0.5);

The 0.5 at the end specifiies 50% opacity. This would apply only to the text, and not the containing element.

You've got to watch the browser compatibility

like image 166
Dan Avatar answered Jan 19 '23 01:01

Dan


use rgba values:

color: rgba(0,0,0, 0.2)
like image 31
Ghilas BELHADJ Avatar answered Jan 19 '23 02:01

Ghilas BELHADJ