Newbie question

Discussion in 'HTML' started by Nikolay Kurtov, Aug 3, 2007.

  1. I have index.html, style.css, image.png in one folder.

    in index.html I include style.css
    <head>
    <title>Newbie question</title>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" /
    >

    <link href="style.css" rel="stylesheet" type="text/css" />
    </head>


    In style.css I set the background:

    body{
    background-image:url("image.png");
    }


    But the image doesn't load.
    How should I correct the url in css?
    Nikolay Kurtov, Aug 3, 2007
    #1
    1. Advertising

  2. Nikolay Kurtov

    John Guest

    "Nikolay Kurtov" <> wrote in message
    news:...
    >I have index.html, style.css, image.png in one folder.
    >
    > in index.html I include style.css
    > <head>
    > <title>Newbie question</title>
    > <meta http-equiv="content-type" content="text/html; charset=utf-8" /
    >>

    > <link href="style.css" rel="stylesheet" type="text/css" />
    > </head>
    >
    >
    > In style.css I set the background:
    >
    > body{
    > background-image:url("image.png");
    > }
    >
    >
    > But the image doesn't load.
    > How should I correct the url in css?
    >


    Hi

    Remove double primes around image.png

    BODY { background-image:url(image.png);

    Regards
    John
    John, Aug 3, 2007
    #2
    1. Advertising

  3. Nikolay Kurtov

    dorayme Guest

    In article
    <>,
    Nikolay Kurtov <> wrote:

    > I have index.html, style.css, image.png in one folder.
    >
    > in index.html I include style.css
    > <head>
    > <title>Newbie question</title>
    > <meta http-equiv="content-type" content="text/html; charset=utf-8" /
    > >

    > <link href="style.css" rel="stylesheet" type="text/css" />
    > </head>
    >
    >
    > In style.css I set the background:
    >
    > body{
    > background-image:url("image.png");
    > }
    >
    >
    > But the image doesn't load.
    > How should I correct the url in css?


    Perhaps you have made a spelling mistake or a space in the name,
    case can be important including in the ".png"? Are you loading to
    a free webhost? Try this on your local machine for your
    index.html:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
    "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <title>Newbie question</title>
    <meta http-equiv="content-type" content="text/html;
    charset=utf-8">

    <style type="text/css">
    body {background: #f00 url("image.png");
    </style>

    </head>
    <body>

    </body>
    </html>

    And see if you see red. Try a different image, one that
    definitely opens when you drag the image file itself to the open
    browser window.

    --
    dorayme
    dorayme, Aug 3, 2007
    #3
  4. Nikolay Kurtov

    dorayme Guest

    In article <>,
    "John" <> wrote:

    >
    > "Nikolay Kurtov" <> wrote in message
    > news:...
    > >I have index.html, style.css, image.png in one folder.
    > >
    > > in index.html I include style.css
    > > <head>
    > > <title>Newbie question</title>
    > > <meta http-equiv="content-type" content="text/html; charset=utf-8" /
    > >>

    > > <link href="style.css" rel="stylesheet" type="text/css" />
    > > </head>
    > >
    > >
    > > In style.css I set the background:
    > >
    > > body{
    > > background-image:url("image.png");
    > > }
    > >
    > >
    > > But the image doesn't load.
    > > How should I correct the url in css?
    > >

    >
    > Hi
    >
    > Remove double primes around image.png
    >
    > BODY { background-image:url(image.png);
    >
    > Regards
    > John


    I can't see why would that work? Perhaps you know something?

    http://members.optushome.com.au/droovies/test/test88.html

    but exactly same code does not work on

    http://dorayme.150m.com/test88.html

    Seems to be independent of the ""

    --
    dorayme
    dorayme, Aug 3, 2007
    #4
  5. Nikolay Kurtov

    mrcakey Guest

    "Nikolay Kurtov" <> wrote in message
    news:...
    >I have index.html, style.css, image.png in one folder.
    >
    > in index.html I include style.css
    > <head>
    > <title>Newbie question</title>
    > <meta http-equiv="content-type" content="text/html; charset=utf-8" /
    >>

    > <link href="style.css" rel="stylesheet" type="text/css" />
    > </head>
    >
    >
    > In style.css I set the background:
    >
    > body{
    > background-image:url("image.png");
    > }
    >
    >
    > But the image doesn't load.
    > How should I correct the url in css?
    >


    Have you included <body> </body> tags in your HTML?

    +mrcakey
    mrcakey, Aug 3, 2007
    #5
  6. Nikolay Kurtov

    rf Guest

    "mrcakey" <> wrote in message
    news:f8uu10$lag$...
    > "Nikolay Kurtov" <> wrote in message
    > news:...


    > Have you included <body> </body> tags in your HTML?


    Body is an optional element in HTML.

    In this case a URL is essential to solving the OP's problem.

    --
    Richard.
    rf, Aug 3, 2007
    #6
  7. Nikolay Kurtov

    mbstevens Guest

    Nikolay Kurtov wrote:
    > I have index.html, style.css, image.png in one folder.
    >
    > in index.html I include style.css
    > <head>
    > <title>Newbie question</title>
    > <meta http-equiv="content-type" content="text/html; charset=utf-8" /
    > <link href="style.css" rel="stylesheet" type="text/css" />
    > </head>
    >
    >
    > In style.css I set the background:
    >
    > body{
    > background-image:url("image.png");
    > }
    >
    >
    > But the image doesn't load.
    > How should I correct the url in css?
    >

    In addition to the possibilities reflected in other answers, consider
    whether you are posting from a Windows machine. Capitalization does not
    matter there, but may on your server. For instance, IMAGE.PNG on a
    windows machine would not load under a *[iu]x machine if you called it
    "image.png".
    mbstevens, Aug 3, 2007
    #7
  8. Nikolay Kurtov

    mrcakey Guest

    "rf" <> wrote in message
    news:fQGsi.15622$...
    >
    > "mrcakey" <> wrote in message
    > news:f8uu10$lag$...
    >> "Nikolay Kurtov" <> wrote in message
    >> news:...

    >
    >> Have you included <body> </body> tags in your HTML?

    >
    > Body is an optional element in HTML.
    >
    > In this case a URL is essential to solving the OP's problem.
    >


    But the picture he/she's hoping to display is specified in the CSS as a
    background to the body.

    +mrcakey
    mrcakey, Aug 3, 2007
    #8
  9. ..oO(mrcakey)

    >"rf" <> wrote
    >>
    >> Body is an optional element in HTML.
    >>
    >> In this case a URL is essential to solving the OP's problem.

    >
    >But the picture he/she's hoping to display is specified in the CSS as a
    >background to the body.


    The 'body' element is always there, even if it's not explicitly
    mentioned in the HTML source code. Like 'tbody' for example.

    Micha
    Michael Fesser, Aug 3, 2007
    #9
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jerry C.
    Replies:
    8
    Views:
    214
    Uri Guttman
    Nov 23, 2003
  2. Kruno Saho
    Replies:
    0
    Views:
    128
    Kruno Saho
    Apr 7, 2013
  3. Dave Angel
    Replies:
    0
    Views:
    113
    Dave Angel
    Apr 7, 2013
  4. rusi
    Replies:
    0
    Views:
    102
  5. Miki Tebeka
    Replies:
    0
    Views:
    76
    Miki Tebeka
    Apr 7, 2013
Loading...

Share This Page