Results 1 to 5 of 5

Thread: CSS background-color issues

  1. #1
    Join Date
    Sep 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question CSS background-color issues

    Hi

    I am trying to create a tableless layout with CSS and I have a problem. Here is my CSS

    body { background-image: "pixURL" }
    container { background-color: white }
    contentL { background-color: white }
    contentC { background-color: white; }

    contentL and contentC are nested within container and container is nested within body.

    I'm trying to set the background-color of the container element to white so that even though the heights of contentL and contentC are different, there will still be a uniform white background.

    For some reason it is not working. columnL is shorter than columnC (as expected) and so you can see the image that is used for the background of the body tag below columnL. This happens even though both columnL and columnC are nested withing container and container's background-color is set to white.

    Any recommendations would be great. I'm trying to create a tabless design.

    Thanks
    M

  2. #2
    Join Date
    Oct 2009
    Posts
    845
    Thanks
    14
    Thanked 189 Times in 188 Posts

    Default

    Do you have a link to the page. It is a little bit difficult to visualize the problem from your description alone.

  3. #3
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    I see a few problems with this

    body { background-image: "pixURL" }
    container { background-color: white }
    contentL { background-color: white }
    contentC { background-color: white; }
    Are the contents ids or classes?

    If ids it should be

    Code:
    body { background-image: url("pix.jpg"); }
    #container { background-color: #ffffff; }
    #contentL { background-color: #ffffff; }
    #contentC { background-color: #ffffff; }
    If classes change the # to . Every property needs to end with a ; and I think if you are using a name like you did you'd need it in quotes the straight entry is for hex code.
    Corrections to my coding/thoughts welcome.

  4. #4
    Join Date
    Sep 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hello

    You are correct, the contentL, contentC and container are all IDs (none are classes) and in my code I wrote them as you have. I had used short-hand in my initial posting because there are other attributes associated with those and I didn't want my posting to be too long.

    Here are the actual styles from my code

    body
    {
    margin: 0px;
    padding: 0;
    font-family: 'Calibri', Arial, San-Serif;
    font-size: small;
    background-color:#ffffff;
    color:#444;
    background: fixed;
    background-image:url(pix/bkgrdgrayfade.gif);
    background-repeat: repeat-x;
    }


    #container
    {
    width:950px;
    margin:10px auto;
    background-color:#FFFFFF;
    }


    #contentL
    {
    margin:0em 0em 0em 0em;
    padding:0em 0em 0em 0em;
    width:153px;
    float:left;
    background-color:#FFFFFF;
    height:1200px
    }


    #contentC
    {
    margin:0em 0em 0em 0em;
    padding: 0em 0em 0em 0em;
    float:right;
    width:790px;
    border-left:thin gray solid;
    background-color:#FFFFFF;
    }

    If you notice that I listed a height value for contentL, that is because I was trying to estimate the height of contentC. The 1200px is about 1/2 as long as it needs to be.

    Again, I'm hoping that nesting the two contentL and contentC DIVs in the container DIV would resolve the issue. But at this point it hasn't. (I had tried to set the background-color attribute of the body tag to #ffffff; in addition to setting the background-image attribute. I then set the background-color attribute of container to inherit. That didn't help either, so that is why the background-color attribute is still listed in for the body tag)

    Thanks,
    M
    Last edited by mran; 09-14-2010 at 11:22 PM.

  5. #5
    Join Date
    Sep 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi,

    I do not have a link to this page at this point. It is not live yet and is set up on my desktop.

    Thanks,
    Michael

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
  •