Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS help with opacity

  • This topic is empty.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #33550
    cybershot
    Participant

    I am using css to set the opacity of a div for the first time. The div has a background color of black. The opacity is working fine and is doing exactly what I want it to do. My problem is that I didn’t realize that it would also make the contents of the div have the same opacity. I tried to put the contents in a new div and set the opacity lower, but it don’t seem to work. I am trying to put white text in the box but the text is coming out brown because of the opacity setting on the parent div. Anyone know how to get around this issue?

    #83600
    furrball1383
    Member

    basically you make two divs with the same dimensions, then place the text in one of them and the effect in the other, after this use z-index so that the effect div is pushed below the text div and hey presto!

    #83601
    cybershot
    Participant

    I couldn’t get it working.


    #navigation {
    width: 180px;
    min-height: 104px;
    background: #000;
    opacity:.55;
    filter:alpha(opacity=55);
    filter: "alpha(opacity=55)";
    padding: 20px;
    z-index: 50;

    }

    #nav {
    color: #fff;
    width: 180px;
    min-height: 104px;
    z-index: 100;
    }




    #83603
    chrisburton
    Participant

    Use rgba for the background color

    #83605
    cybershot
    Participant

    thanks for the link. I will check it out.

    #83608
    furrball1383
    Member

    and once again I learned something new!

Viewing 6 posts - 1 through 6 (of 6 total)
  • The forum ‘CSS’ is closed to new topics and replies.