Solved

opacity and filter

Posted on 2006-10-21
6
616 Views
Last Modified: 2008-02-01

Hi,

In an html page with a light image background I am trying to set an area with some text.
Since the text kind of fade in the light background I used opacity and filter on the text area background:

background-color:#751B8C;
opacity: .65;
filter: alpha(opacity=65);

The problem is that its also fades the text… how is it possible to have this opacity and filter not to affect the text inside?
0
Comment
Question by:Refael
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
6 Comments
 
LVL 2

Accepted Solution

by:
harshgrover earned 125 total points
ID: 17779263
you should use classes. use one class to apply to the tag that uses the background, and then, use another nested tag within, which would have another class attribute, with the opacity as 100...it would look something like this

<div id="parent" class="transparentbg">
    <div id=text" class="normalbg">
        this is where you would insert the text
    </div>
</div>

the css would look like this.

.transparentbg{
    background-image: url(someImage.gif);
    opacity: .65;
    filter: alpha(opacity=65);
}

.normalbg{
    background-color:#751B8C;
    opacity: 1;
    filter: alpha(opacity=100);
}


Lemee know if this works for you

~Gary
0
 

Author Comment

by:Refael
ID: 17779297

thanks!

its applies to a td....

<td valign="top" id="parent" class="transparentbg">

the style is not with an image.....

}
.transparentbg{
background-color:#222222;
opacity: .65;
filter: alpha(opacity=65);
}

then right after the TD i added the DIV to insert the text...

<div id="text" class="normalbg">

with the style.....

.normalbg{
    background-color:#751B8C;
      color:#FFFFFF;
    opacity: 0;
    filter: alpha(opacity=100);
}

for some reason the background is changed but the the font color still fading?!?!?




0
 
LVL 30

Assisted Solution

by:GrandSchtroumpf
GrandSchtroumpf earned 125 total points
ID: 17784417
Opacity is not inherited.  So specifying 100% opacity on an inner element will have no effect.
For a semi-transparent background, use an alpha-transparent PNG image.

For IE6, uset the background image and use a filter:
  background-image: none;
  filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, src=background.png, sizingMethod=scale);
0
 
LVL 30

Expert Comment

by:GrandSchtroumpf
ID: 17784420
"uset" should read "unset"  :)
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When applying CSS to your HTML, there are many different ways to select which element(s) the CSS applies to.  Some of these selectors are more commonly known and used than others - Here are the more common ones: #X - Matches an ID of X .X - Matche…
So you have coded your own WordPress plugin and now you want to allow users to upload images to a folder in the plugin folder rather than the default media location? Follow along and this article will show you how to do just that!
In this tutorial viewers will learn how add a full-size background image to a webpage using CSS3. Create a new HTML document with an internal stylesheet.: In CSS, define the html element to have a background image. Use a high resolution image.: In t…
In this tutorial viewers will learn how to style different bullet points for unordered lists in CSS. Begin with a normal unordered list; the default bullet point is a solid circle: In the CSS, create a defined class of unordered list by typing "ul.S…

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question