Results 1 to 3 of 3

Thread: CSS Cross Browser Transparancy

  1. #1
    Join Date
    Jul 2006
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation CSS Cross Browser Transparancy

    Hey, Im trying to fit a transparancy code into the html of my page. I tried it using insert shapes in front page and changing the transparency but as i expected, it didnt work on firefox, opera or anything apart from IE. I then resorted to CSS. I used this style function for each cell in the table.

    CSS

    .transbox {
    filter:alpha(opacity=50);
    -moz-opacity:0.5;
    opacity: 0.5;
    }

    HTML

    <div class="transbox">
    table info
    </div>

    i messed about with this for a while and it seems to work, the only problem is it effects the text in the table also. Is there anyway of altering the code so it doesnt effect the text and the text in the table keeps its original formatting? Im trying not to use background .png images!

    JM

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Unfortunately not, no. A child cannot have an opacity that exceeds that of its parent element. PNG images are the only way to do that.

    You also missed -khtml-opacity.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Twey is right however, depending upon how you want things to look and the colors that you are dealing with, things can sometimes be worked out by making the text either darker or lighter and perhaps bold. Another strategy is to absolutely position the table that uses semi-transparency via opacity and then absolutely position another table on top of it that uses background-color:transparent. Then, put your background images in the first table and your text in the second.

    There are advantages and disadvantages to either method but, both avoid having to deal with IE's alpha image loader which is required when using semi-transparent .pngs and can be a pain to master. Still, it is not all that hard to use and does do the job. It helps tremendously if you have IE to check your work in, how it looks.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •