Forums

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

Home Forums CSS Problem with css code background.

  • This topic is empty.
Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #39530
    Ani_
    Participant

    HI all,

    i was trying to follow the tutorials about the photoshop mockup, and i created the layout but now i got the problem that the wooden background wont appear when i open my index file. Maybe someone can help me.

    Here is the html code:









    Main content.







    And here is the css:

    /* RESETS & BASIC PAGE SETUP */
    * { margin:0; padding: 0; }
    html { overflow-y: scroll; }
    body {
    font: 62.5% "Lucida Grande", sans-serif;
    background: url(images/body_bg.jpg) ; }

    ul { list-style: none inside; }
    p { font-size: 1.2em; line height: 1.2em; margin-bottom: 1.2 em; }
    a img {border: none; }
    /* END RESET */

    /* TOOOLBOX */
    .floatleft { float: left; }
    .floatright {float: right; }
    .clear { clear: both; }
    /* END TOOLBOX */



    well thanks in advance and i hope to hear from someone.

    Ani_

    #108534
    TheDoc
    Member

    Do you have a link to the site?

    I’m guessing that your path to your image is wrong.

    #108537
    Ani_
    Participant

    it isn’t online yet. the images map is located in the root folder so i thought the path was images/body_bg.jpg becouse it is in roots right? still let me re-check and thanks for looking at it! :)

    #108545
    TheDoc
    Member

    It depends on where your CSS file is. If your CSS file is in a folder in the root called CSS then you’d have to back out to the root and then go to the images folder.

    url(/images/body_bg.jpg)

    The above code will go right to the root, then check for an ‘images’ folder.

    url(../images/body_bg.jpg)

    The above code will move one folder up from the current position and then check for an ‘images’ folder.

    url(‘../../images/body_bg.jpg)

    Will go two folders up and check…

    You get the idea!

    #108549
    Ani_
    Participant

    Yes thats probaly the problem! My style.css file is in the map css. So in order for my css to find the image it will have to get out of the directory css to find it. Will let you know if it worked!

    Thanks!

    #108550
    Ani_
    Participant

    Yes thats probaly the problem! My style.css file is in the map css. So in order for my css to find the image it will have to get out of the directory css to find it. Will let you know if it worked!

    Thanks!

    #108582
    Ani_
    Participant

    well i did it how you told me, but i still wont see any background. ill show you the code:

    /* RESETS & BASIC PAGE SETUP */
    * { margin:0; padding: 0; }
    html { overflow-y: scroll; }
    body {
    font: 62.5% "Lucida Grande", sans-serif;
    background: url(../images/body_bg.jpg) ; }

    ul { list-style: none inside; }
    p { font-size: 1.2em; line height: 1.2em; margin-bottom: 1.2 em; }
    a img {border: none; }
    /* END RESET */

    /* TOOOLBOX */
    .floatleft { float: left; }
    .floatright {float: right; }
    .clear { clear: both; }
    /* END TOOLBOX */

    as you see i changed the path to go up one folder and then search for the images folder and then for body_bg.jpg but it wont show.

    #108593
    Watson90
    Member

    Hi there Ani,

    It seems like you’re doing everything right.

    Maybe try:

    body {
    font: 62.5% "Lucida Grande", sans-serif;
    background-image: url(/images/body_bg.jpg);
    }

    I set the property to background-image rather than background. Just see if that works instead.

    Thanks

    #108594
    Ani_
    Participant

    hmm i copied the code just like you typed here but my nice wooden background wont appear haha. so i realy dont know what to do now :P

    #108598
    Ani_
    Participant

    one way or another i scripted everything from scrap and now it works oleee:P thanks for evrything guys!

    #108600
    Watson90
    Member

    Weirrddd! Haha, glad everything worked out :)

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