opacity and filter

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


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:

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?
Question by:Refael
  • 2

Accepted Solution

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 would look something like this

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

the css would look like this.

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

    opacity: 1;
    filter: alpha(opacity=100);

Lemee know if this works for you


Author Comment

ID: 17779297


its applies to a td....

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

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

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.....

    opacity: 0;
    filter: alpha(opacity=100);

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

LVL 30

Assisted Solution

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);
LVL 30

Expert Comment

ID: 17784420
"uset" should read "unset"  :)

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
jQuery Animation faster 5 43
Error in page 3 46
Why my select dropdown does not work? 8 27
Not seen Link button 5 17
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 …
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

867 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

21 Experts available now in Live!

Get 1:1 Help Now