Simple CSS question - making the left sidebar black background

Discussion in 'CSS' started by JakeThePeg, Nov 6, 2009.

  1. #1
    Howdy

    I have a simple question, but am hopeless at CSS. Can someone please tell me how to make the background of the widgets (in the left side bar) of this site black please?

    http://tshirtalert.com/tweets/

    Thanks so much

    Jake
     
    JakeThePeg, Nov 6, 2009 IP
  2. Stomme poes

    Stomme poes Peon

    Messages:
    3,195
    Likes Received:
    136
    Best Answers:
    0
    Trophy Points:
    0
    #2
    uh, even after turning on Javascript, I don't think I'm seeing the page the way you expect. I'm getting a MySpace visual here.

    Can you post a screenshot and circle what you mean? The left side looks pretty blackish from over here.
     
    Stomme poes, Nov 6, 2009 IP
  3. LeetPCUser

    LeetPCUser Peon

    Messages:
    711
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #3
    current code

    
    #sidebar
    {
     float:left;
    }
    
    Code (markup):
    new code

    
    #sidebar
    {
     float:left;
    [COLOR="Red"] background:#000000;[/COLOR]
    }
    
    Code (markup):
    Looks like you may have to add in a clearfix too because your div isn't spanning as far as it should.
     
    LeetPCUser, Nov 6, 2009 IP
  4. twincircuits

    twincircuits Peon

    Messages:
    16
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Actually, you could just do background: #000; :p
     
    twincircuits, Nov 6, 2009 IP
  5. JakeThePeg

    JakeThePeg Active Member

    Messages:
    230
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    #5
    Thanks dude - it's one step closer - have a look now.

    But the sidebar now needs to be a smidgen wider, how do I do that? And how do I get it to extend to the bottom bottom of the sidebar?
     
    JakeThePeg, Nov 6, 2009 IP
  6. JakeThePeg

    JakeThePeg Active Member

    Messages:
    230
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    #6
    Any bored CSS gurus out there? I'd love a litttle assistance regarding the above, if possible please?

    I'm trying to get the left sidebar on www.tshirtalert.com/tweets to extend a little further to the right, and further down the page, in order to cover all of the text and images contained within the sidebar. But alas, I'm hopeless at CSS :)
     
    JakeThePeg, Nov 7, 2009 IP
  7. supernoobice

    supernoobice Peon

    Messages:
    376
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #7
    try adding an overflow to the div that covers the whole side bar.

    #sidebar {
    overflow: auto;
    }
     
    supernoobice, Nov 7, 2009 IP
  8. jauhari

    jauhari Peon

    Messages:
    55
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Yes, add overfow: auto
     
    jauhari, Nov 7, 2009 IP
  9. JakeThePeg

    JakeThePeg Active Member

    Messages:
    230
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    #9
    Overflow was no good, it caused an extra scroll bar to appear, kind of like an iframe. Instead, I just deleted the set height of the sidebar (it was set to 400 pixels high), and made the image within the sidebar narrower, instead of trying to make the sidebar expand to the width of the image ;)
     
    JakeThePeg, Nov 7, 2009 IP
  10. Stomme poes

    Stomme poes Peon

    Messages:
    3,195
    Likes Received:
    136
    Best Answers:
    0
    Trophy Points:
    0
    #10
    The reason people offered the overflow: auto is because if your sidebar had been static and had floats inside it, then setting a background colour on it wouldn't show up. Setting overflow (anything other than the default of visible) will make a box wrap its children.

    But since your sidebar was already floated it didn't have that problem. Everything inside the sidebar could have been floated and it wouldn't have mattered because floats wrap floats in every case : )

    Having a set height on anything is generally a bad idea because then it can't grow with the content.

    However next time, if you have a static (non-floated) box with floats in it and the background isn't showing up, you can try overflow: hidden (so long as you don't have a set height) instead of "auto". Auto gives you the scrollbars you see if the content inside is wider than your stated width or taller than your stated height... but you would not have seen scrollbars with "auto" if you hadn't had the set height.

    Now I have to go look at your site again to see what you were talking about... everything was already black the first time I looked.
     
    Stomme poes, Nov 8, 2009 IP