Darkmatter5 Posted August 28, 2009 Share Posted August 28, 2009 Here's my css code: #pc_toolbar_cell { -moz-opacity: 0.25; filter: alpha(opacity=25); opacity: .25; background-image: url(../images/nuclear.png); background-repeat: no-repeat; background-position: center; } <th width='25%' height='100' id='pc_toolbar_cell'>test</th> This makes the background semi-transparent, but also makes the text semi-transparent. How can I make the opacity stuff only affect the background image and NOT the content of the <th>?? Link to comment https://forums.phpfreaks.com/topic/172332-help-with-opacity-on-background-image-but-not-text-contents/ Share on other sites More sharing options...
Hybride Posted August 30, 2009 Share Posted August 30, 2009 This tutorial may be of some help: Transparencies. You could try something like: #pc_toolbar_cell { -moz-opacity: 0.25; filter: alpha(opacity=25); opacity: .25; background-image: url(../images/nuclear.png); background-repeat: no-repeat; background-position: center; } #pc_toolbar_cell p{ color:#000 } <th width='25%' height='100' id='pc_toolbar_cell'><p>test</p></th> Link to comment https://forums.phpfreaks.com/topic/172332-help-with-opacity-on-background-image-but-not-text-contents/#findComment-909317 Share on other sites More sharing options...
haku Posted August 31, 2009 Share Posted August 31, 2009 The maximum opacity for anything is the opacity of it's parent. So if you set the opacity of a div to 50%, then the maximum opacity for anything inside that div will be 50%. So if you set the opacity on the text to 50%, the actual opacity of the text will be 25%: 50% of 50%. So the only way to do this is through some creative CSS and possibly some Javascript - you will need to create the text in a div not inside the lowered opacity div, then position the text over the lowered opacity div using absolute, fixed, or relative positioning. Link to comment https://forums.phpfreaks.com/topic/172332-help-with-opacity-on-background-image-but-not-text-contents/#findComment-909493 Share on other sites More sharing options...
TheFilmGod Posted August 31, 2009 Share Posted August 31, 2009 OR you can use a png with semi-transparency as the background?? Link to comment https://forums.phpfreaks.com/topic/172332-help-with-opacity-on-background-image-but-not-text-contents/#findComment-909714 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.