开发者

why won't my image show?

My image is saved in the same folder tree or whatever that is called as my webpage, and it won't load. It's probably something really simple but I can't figure it out. Any hint would be appreciated.

    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML     4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <meta content="text/html; charset=ISO-8859-1"
    http-equiv="content-type">
    <title>website</title>
 开发者_StackOverflow   <style type="text/css" media="screen, print, projection">

    body{
         background-image:url('C:\Users\blah\Desktop\webdesign\randompicture.png');
    }


    </style> 
    </head>
    <body>
    </body>
    </html>


instead of C:\Users\blah\Desktop\webdesign\randompicture.png'

use relative path if your htm file is in webdesign folder randompicture.png

use background-image: url(randompicture.png);

if the html file is on desktop

use background-image: url('./webdesign/randompicture.png');


Try using relative paths, if your picture is in the same directory as your html file, simply write:

background-image: url(randompicture.png);

Also, you don't need apostrophes in the url() notation of CSS.

If you put your rules into a separate CSS file, the path should be relative to the CSS file, not the HTML.


if the image is in the same folder, use:

body
{
   background-image: url('randompicture.png');
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜