add a background picture

liunx

Guest
how to do this. name of image is img_1509<br />
<br />
i have made an HTML folder containing two files <br />
a) bold.html<br />
b) img_1509<br />
<br />
in file bold.html i'm writing code <br />
<br />
<html><br />
<head><br />
<title> my name is avneet </title><br />
</head><br />
<br />
<body><br />
<h1> narration</h1> <br />
<hr size=50 noshade><br />
<br />
tehdiwndijwidsm<br><br />
jduendudmd<br><br />
</body><br />
</html><br />
<br />
<body background="IMG_1509.jpg"><br />
<br />
isn't working.................<!--content-->Looks like you're using two <body> tags. Try replacing the first with the second...<!--content-->I'd also suggest using CSS instead:<style type="text/css"><br />
/*<![CDATA[*/<br />
body {<br />
background-image: url(foo.png);<br />
}<br />
/*]]>*/<br />
</style><!--content-->i tried replacing but nothing happened .<br />
as far as CSS is concerned , i haven't studied that yet. <br />
<br />
is there a problem that it cannot locate the image ?<br />
or <br />
i think there is definitely something wrong with my using the body tags.<!--content-->Replacing the <body> with the <body background="IMG_1509.jpg"> should have worked if your image is in the same directory as your HTML page.<br />
<br />
Your code should look something like this:<br />
<br />
<br />
<html> <br />
<head> <br />
<title> my name is avneet </title> <br />
</head> <br />
<br />
<body background="IMG_1509.jpg"> <br />
<h1> narration</h1> <br />
<hr size=50 noshade> <br />
<br />
tehdiwndijwidsm<br> <br />
jduendudmd<br> <br />
</body> <br />
</html> <br />
<br />
<br />
<br />
If you have your code like that and you have verified the graphic file is in the same directory, then you might check the file name to make sure you have the correct spelling or correct case as the file.<br />
<br />
If it still doesn't work repost the code, maybe there is something small in there that is being missed.<!--content-->i caught the problem . actually it was a shortcut to the image,so i gave the full path & it worked.<br />
now the weird thing is that on the screen it's showing 4 copies of the same picture, 2above,2 below & why not just one picture.<!--content-->Because the default behaviour is to tile the image to fill the div. Use no-repeat to show it once.<!--content-->ok the material on net says ,if the image is smaller than the page then it'll repeat.<br />
what to do for no repeat .<br />
what & where to write in this code???<!--content-->I believe it will look like this:<br />
<br />
<body background="IMG_1509.jpg" style="background-repeat: no-repeat"><br />
<br />
Ray, please correct me if I'm wrong.<!--content--><style type="text/css"><br />
/*<![CDATA[*/<br />
body {<br />
background: transparent url(foo.png) no-repeat;<br />
}<br />
/*]]>*/<br />
</style><!--content-->yeah it worked!!!<br />
thanx guys for all your help.<!--content-->Originally posted by jaegernaut <br />
I believe it will look like this:<br />
<br />
<body background="IMG_1509.jpg" style="background-repeat: no-repeat"><br />
<br />
Ray, please correct me if I'm wrong. <br />
No need; I've got Fred to do that! :D I suspect that will work ok but I do like the CSS version better.<!--content-->
 
Back
Top