Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Mar 2009
    Posts
    101
    Thanks
    14
    Thanked 1 Time in 1 Post

    Question Deactivate background: transparent?

    I've a site that I need to add in the CSS for the BODY:
    background: transparent

    But, for one particular DIV ID, I need it to not be transparent -- yet, when I assign it a color: background: #FFFFFF, it doesn't "take," it's still transparent.

    Is there something I can do to pointedly make the background not do that for that DIV?

    Thanks.
    Last edited by Mechphisto; 04-20-2011 at 07:11 PM.

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,854
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    Is there something I can do to pointedly make the background not do that for that DIV?
    No! There may be something else that plays in your case and surely we can't guess it without seeing your code a link to your page.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    Senior Coder
    Join Date
    Jan 2005
    Location
    Memphis, TN
    Posts
    1,785
    Thanks
    8
    Thanked 131 Times in 129 Posts
    so you have:

    Code:
    body {
    background: transparent;
    }
    is that right? What color do you see? What do expect to happen?

    For example:

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
           "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
     <html xmlns="http://www.w3.org/1999/xhtml"> 
    
     <head> 
    <title>Confused</title> 
     <style type="text/css"> 
     html {
     background: pink;
     }
     
     body {
     background: transparent;
     }
     
    div {
     height: 800px;
     background: #9dd;
     width: 100px;
     }
     </style> 
     
     </head> 
    
     <body> 
    
     <div></div>
     </body> 
     </html>
    gives me a pink background for the html{}, no background for the body{} and a blue div.

    If you have set your default background by the OS, then you have to remember that not everyone will have the same color as you.
    Stop making things so hard on yourself.
    i is tugbucket :: help raise tugburg :: Whitehaven Kiwanis

  • #4
    Regular Coder
    Join Date
    Mar 2009
    Posts
    101
    Thanks
    14
    Thanked 1 Time in 1 Post
    Gah! Thanks for Firebug in Firefox, I discovered the DIV was nested in another DIV, and I was altering the wrong DIV. I fixed it.
    Thanks for the replies!

    Oh, and abduraooft: I wasn't expecting anyone to guess; I was hoping maybe there was a quirk of CSS that I wasn't aware of. After all, there's a clear:both which "turns off" float, for all I knew there was a background:reset; or something I didn't know about.


  •  

    Posting Permissions

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