Results 1 to 5 of 5

Thread: Opacity prob`

  1. #1
    Join Date
    Jan 2006
    Location
    Derbyshire, UK
    Posts
    74
    Thanks
    16
    Thanked 0 Times in 0 Posts

    Default Opacity prob`

    I've set a wrapper DIV to 0.4 opacity, how do I prevent the opacity of any content?

    Thanks in advance
    Last edited by jscheuer1; 05-08-2012 at 03:39 AM.

  2. #2
    Join Date
    Nov 2006
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    1,920
    Thanks
    2
    Thanked 267 Times in 262 Posts

    Default

    Hi there Burgin,

    try it with "rgba()"...
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
       "http://www.w3.org/TR/html4/strict.dtd">
    <html lang="en">
    <head>
    
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="language" content="english"> 
    <meta http-equiv="Content-Style-Type" content="text/css">
    
    <title></title>
    
    <style type="text/css">
    #box {
        width:324px;
        line-height:200px;
        border:1px solid #000;
        margin:24px auto 0;
        font-family:verdana,sans-serif;
        font-size:28px;
        font-weight:bold;
        text-align:center;
        color:rgb(255,0,0);
        background-color:rgba(255,0,0,0.4);
     }
    </style>
    
    </head>
    <body>
    
    <div id="box">opacity test</div>
    
    </body>
    </html>
    
    coothead

  3. The Following User Says Thank You to coothead For This Useful Post:

    Burgin (04-09-2012)

  4. #3
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    to clarify,

    opacity applies to an element and all of its content (all child elements and text). it's supposed to work this way; you can't "prevent" it.

    if you only want the background to be semi-transparent, use an rgba value for the element's background, as coothead suggests.

  5. The Following User Says Thank You to traq For This Useful Post:

    Burgin (04-09-2012)

  6. #4
    Join Date
    Jan 2006
    Location
    Derbyshire, UK
    Posts
    74
    Thanks
    16
    Thanked 0 Times in 0 Posts

    Default

    @traq @coothead... Thanks, that's beautiful.

  7. #5
    Join Date
    Nov 2006
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    1,920
    Thanks
    2
    Thanked 267 Times in 262 Posts

    Default

    No problem, you're very welcome.

    coothead

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
  •