Results 1 to 3 of 3

Thread: CSS- Background img not showing up in container

  1. #1
    Join Date
    Jun 2008
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default CSS- Background img not showing up in container

    Hello, I am new to css but not to webpages. I used to design pages using tables and now I want to learn and design using css. But I'm having trouble and I figure its a quick fix. Note this website is not on line I am doing my test use IE 7 and Firefox ver 2 PC Ver.

    Q: I'm trying to design a website for a client and I am have trouble try to get my background img to show up in my #container. Here is sample of my basic layout. Hope some could help me.


    Code:
    @charset "utf-8";
    
    body {
    background-color: #271a0b;
    background-image: url(../images/bgStrip.gif);
    background-repeat: repeat-x;
    }
    
    #container {
    width: 100%;
    height: 900px;
    overflow: hidden;
    background-image: url(/images/backGround.jpg);
    background-repeat: no-repeat;
    background-position: 0;
    }
    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>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    
    <link href="asset/screen.css" rel="stylesheet" type="text/css" />
    </head>
    
    <body>
    <div id="container">Content for id &quot;container&quot; Goes Here</div>
    
    </body>
    </html>
    body background is working. Note: Got the codes samples from CSS Cookbook, good book learning allot but can't seem to get it to work. Hope some could help me.

  2. #2
    Join Date
    Jul 2007
    Location
    Azerbaijan, Baku
    Posts
    144
    Thanks
    11
    Thanked 27 Times in 25 Posts

    Default

    If images folder is in one place then your mistake is in red highlighted place:
    Code:
    body {
    background-color: #271a0b;
    background-image: url(../images/bgStrip.gif);
    background-repeat: repeat-x;
    }
    
    #container {
    width: 100%;
    height: 900px;
    overflow: hidden;
    background-image: url(/images/backGround.jpg);
    background-repeat: no-repeat;
    background-position: 0;
    }
    Change that row to this:

    Code:
    background-image: url(../images/backGround.jpg);

  3. #3
    Join Date
    Jun 2008
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Talking

    That was it!! Over looked that because Dreaweaver wrote it and it was 3am for me. Better to have second set of eyes. Thanks.

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
  •