Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Background Image Display

  • This topic is empty.
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #22893

    This is literally killing me. All sorts of ulcers over this and can’t figure it out. I have a div of content that i want to set a background image to. I can not for the life of me get it to display. I can change the colors just fine so i know i’m working within the correct parameters…or so i think. here’s the css:

    #content {
    width:400px;
    height:342px;
    float:left;
    background:gray;
    background:url("bgimage.jpg");
    border:1px solid blue;
    }

    Another note: Are there certain criteria to be able to shorthand? I’ve even copied examples straight off sites and will not get it to work correctly, but if I list this way above, which is actually the way I prefer for my own sanity, it will not work either. It would just be nice to know why. Obviously a new css user and am loving every bit of it. should have learned this a long time ago. Thanks for your help!!

    #48403
    pab
    Member

    instead of this

    background:gray;
    background:url("bgimage.jpg");

    Try this
    #content {
    background:url("bgimage.jpg") gray;
    }

    you can also set the position in there.

    not sure if that’s the issue but i hope it helps.

    pab

    ps make sure your image is in the same folder

    #48404
    Biofobico
    Member

    Try this;

    Code:
    #content {
    width:400px;
    height:342px;
    float:left;
    background:gray;
    background: url(bgimage.jpg); ( without the quotes)
    border:1px solid blue;
    }
    #48407

    Thanks guys for the quick reply but neither of the codes worked correctly either. I’ll just throw it all out here:

    html

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
    <html xmlns="http://www.w3.org/1999/xhtml"&gt;
    <html>
    <head>
    <link rel="stylesheet" type="text/css" href="css/style.css" />
    <title>no bg image?!?</title>
    </head>
    <body>

    <div id="right">
    <ul>
    <li>list one</li>
    <li>list two</li>
    <li>list three</li>
    </ul>

    </div>
    </body>
    </html>

    css:
    /* RIGHT SECTION */

    #right {
    width:150px;
    height:342px;
    float:left;
    border:1px solid red;
    background:gray;
    background:url("bgimage.jpg");
    }

    Just in case someone could see something else. It is the most cut and dry it could possibly be. I even resized the div to the correct size of the bg pic. Thanks again.

    #48408
    pab
    Member

    could you post a link to the page?

    #48409
    Biofobico
    Member

    Are you sure that the path to the image is correct?

    #48411

    Thanks for all your help and quick responses. I did manage to get it to work….everything (html, css, and image) were all in the same folder to begin with but nevertheless I ended up just saving everything in a seperate folder again and it started working. got to love it.

Viewing 7 posts - 1 through 7 (of 7 total)
  • The forum ‘CSS’ is closed to new topics and replies.