Results 1 to 2 of 2

Thread: Transparent background but not child elements

  1. #1
    Join Date
    Nov 2007
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Transparent background but not child elements

    I am trying to set the background of a element to transparent but not the child elements. Here is the code I have:

    .nav {
    background-color:#000000;
    float:left;
    filter:alpha(opacity=80);
    opacity: 0.8;
    -moz-opacity:0.8;
    width:230px;
    height:230px;
    }

    .navImage{
    width:50px;
    height:50px;
    }


    <div class="nav">
    <div class="navImage"<img src="images/atc_logo.gif"></div>
    </div>

    Any idea if it is possible to make the background transparent but the child elements 100%?

    Thanks in advance.

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

    and a warm welcome to these forums.

    try it like this...
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
       "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    
    <style type="text/css">
    #container {
        position:relative;
        width:230px;
        height:230px;
        float:left;
     }
    .nav {
        position:absolute;
        background-color:#000;
        filter:alpha(opacity=80);
        opacity: 0.8;
        -moz-opacity:0.8;
        width:230px;
        height:230px;
    }
    .navImage{
        position:absolute;
        width:50px;
        height:50px;
        left:90px;
        top:90px;
    }
    </style>
    
    </head>
    <body>
    
    <div id="container">
    
    <div class="nav"></div>
    <div class="navImage"><img src="images/atc_logo.gif" alt=""></div>
    
    </div>
    
    </body>
    </html>
    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
  •