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

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

Technology Partners: 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

CSS3 Custom checkboxes This article shows how to style the checkbox form element using only CSS. Works in: Chrome, FF, Safari, Opera, IE9+ Uses modernizr.js to check for :checked pseudo class, falling back to plain old checkboxes (IE8 and bel…
CSS is a visual language used to classify objects and define rules about how they should be displayed. CSS skills aren’t restricted to developers anymore, there is a big benefit to having a basic understanding of the language, regardless of your occ…
In this Micro Tutorial users will learn how to embed custom fonts into websites using @font-face in CSS Select a font: Ensure the EULA allows you to use @font-face: Download the font: Get the browser-compatible files you need: Edit your CSS       - Name …
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 Browse or search based on font properties or name to find a suitable font for…

740 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