Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Transparent Boxes.. without transparent text

Options
  • 28-08-2010 9:41pm
    #1
    Registered Users Posts: 4,946 ✭✭✭


    .box
    {
    background-color:#151519;
    height: 50px;
    width: 300px;
    filter:alpha(opacity=50);
    opacity: 0.50;
    }



    h2
    {
    color:#FFF;
    filter:alpha(opacity=100);
    opacity: 1.00;
    -moz-opacity:1.0;
    -khtml-opacity: 1.0;
    }



    The above code is what i have so far on a box that i want to shade over a certain area of a page. However, the text thats inside that box (lets say h2) wont stay at full opacity.

    Any ideas?

    Cheers


Comments

  • Closed Accounts Posts: 18,163 ✭✭✭✭Liam Byrne


    That's because h2's "100%" is "100% of the parent". That's the way CSS works.

    Try this : http://css-tricks.com/non-transparent-elements-inside-transparent-elements/


  • Registered Users Posts: 4,946 ✭✭✭red_ice


    that was my understanding of it liam, and your reply was very helpful, however it leaves me with then problem of dynamic text not expanding the box that its covering.

    Any ideas?


  • Closed Accounts Posts: 18,163 ✭✭✭✭Liam Byrne


    Depends on whether you need to support IE

    http://greenevillage.net/csspages/rgba.aspx

    Other than that, you're looking at an image solution.


  • Registered Users Posts: 8,488 ✭✭✭Goodshape


    Opacity isn't what you need. You're looking for background rgba colour.

    Background: rgba(255, 255, 255, 0.5), for instance. Google it :). Browser support ain't the best though.


  • Registered Users Posts: 4,946 ✭✭✭red_ice


    Cheers fellas

    I've decided to scrap that idea now. Im trying to build a site from top to bottom in CSS/jquery without images. I had a subtle, tasteful idea, but the more it developed the more tacky it started to look.

    I've settled on full opacity colour, looks well.

    appreciate the help.


  • Advertisement
Advertisement