Solved

opacity and filter

Posted on 2006-10-21
6
597 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
  • 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Unordered lists (HTML ul tags) are very handy to create menus of all types, shapes and sizes.  All it takes is a little knowledge of CSS and the possibilities are endless. First off, you should know the general format for menus created using the …
Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
In this tutorial viewers will learn how to embed custom externally-hosted Google Fonts using the Google Font API in CSS Go to the Google Fonts website at google.com/fonts: Browse or search based on font properties or name to find a suitable font for…

707 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now