Forum Moderators: open

Message Too Old, No Replies

background image not showing up

         

celticjim

3:25 pm on Jul 20, 2009 (gmt 0)

10+ Year Member



hello all
I've searched using google trying to find answer to my problem with no joy.Some similar questions have been posed here but not exactly what I'm looking for.Thanks for your indulgence and I hope it may help someone else in future.
It's a simple background repeating tile.when I view it in my cpanel(edit html) the repeating tile is there.But when I open the site itself the background does not show.I initially stored the image in an images folder under the root but thinking that may have been the problem I moved it to the root of the site.Still the same issue persists.I can't get my head round this.any suggestion please.I also tried changing the filetype to png and jpg with same result.It's currently gif.

!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Example Title</title>
<link rel="SHORTCUT ICON" href="http://www.example.com/images/eim.ico" />
</head>
<body background="http://www.example.com/starsbackground.gif">
<div align="center"><font color="#33cc33" size="7"><strong>
Example text</strong></font></div>
<div align="center"><font color="#33cc33"><strong>&nbsp;</strong><font size="7"><strong></strong></font></font></div>
<div align="center"><font color="#33cc33"><font size="7"><strong>example text</strong></font></font><br />
</div><br />
</body>
</html>

I must be misssing something obvious.Thanks again

bill

4:34 am on Jul 21, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Welcome to WebmasterWorld celticjim.

The background attribute of the body element was deprecated in HTML 4.01. Most will suggest that you use CSS for this styling instead.

tedster

5:01 am on Jul 21, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



That's true - but browsers will bend over backwards and render deprecated mark-up anyway. "Deprecated" does not mean "not allowed", anyway, it just means "tagged for future extinction" or something like that.

These are some common problems with background images that I've run into:

#1 - There's a typo somewhere
#2 - The image is not on the server, only the local computer
#3 - The path to the image is not what you think it is
#4 - The server MIME type is not set properly for the image type

celticjim

4:25 pm on Jul 21, 2009 (gmt 0)

10+ Year Member



thanks for the answers guys.Looks like I'll have to start researching CSS
tedster,only number 4 of your 4 possibles seems likely as I can see the background showing up in the cpanel edit html screen.Off to google MIME type.Only familiar with that acronym from the ROM gaming world.Adieu gents,all the best

jbinbpt

4:35 pm on Jul 21, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Do you see it if you just enter this as the URL?

http://www.example.com/starsbackground.gif

celticjim

10:04 pm on Jul 21, 2009 (gmt 0)

10+ Year Member



this is very frustrating.I have started from scratch with css and the same thing is happening.To answer you jbinbpt "no that didn't solve the problem"

I have the small stars image (gif type) installed on my server at the root of the domain.I have checked multiple times for typos.I have tried every conceivable path to the image and now I have defined image/gif as being associated with gif images in MIME.What else can I do?

I really don't understand how the background is showing up in my control panel html editor but not live.

Theres not a whole lot of code going on here gents,I am starting from the beginning and I need this background( or similar,have tried another small gif image too with same results).I suppose I may test this with a jpg image and see what happens.I'll be back.Could it possibly be because this image is animated ,albeit simply stars twinkling?

<html>
<head>
<style type="text/css">
body
{
background-image:url('starsbackground.gif');
}
</style>
</head>

<body>
<p>By default, a background image will be repeated both vertically and horizontally.</p>
</body>
</html>

tedster

2:15 am on Jul 22, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



To answer you jbinbpt "no that didn't solve the problem"

If you mean that the url jbinbpt suggested does not display the image in your browser - then the background image is NOT at that path, not at the domain root. Tre image file needs to be exactly where the inde home page html file is (index.html, default.aspx ro whatever your name is).

Maybe you are uploading the image to a folder that is above the actual domain root? It depends on how your hastomg service has configured your account - but there may be a choice of folders when you access by FTP, and one folder is called "www" or "http" or "web" or something like that. Your image file must be IN that folder, and not parallel - not at the same level in the hierarchy as that folder is.

Thgat's just a guess - because this is an error I've made in the past. If by chance you once accidentally uploaded a copy of the index page file in that parallel spot, it can confuse your into thinking you are now uploading to the right spot.

[edited by: tedster at 10:59 pm (utc) on July 22, 2009]

celticjim

9:37 pm on Jul 22, 2009 (gmt 0)

10+ Year Member



ah sorry, my mistake with understanding jbinbpts' question.

the image IS there when I load www.example.com/image.gif into my browser.It's blinking away up in the left corner just as it should be.It's about 120x120 pixels

so it is therefore being summoned at the correct location it would seem to me.It is on an addon domain and I have tried every path to the image including the main domain and even using public_html/maindomain/addon/image.gif and every variation

any other thoughts.It's gotta be something simple.

just tried it with a jpg non-blinking image---same non-result but the image is there in the browser when I type it in www.example.com/image.jpg

this is baffling me

celticjim

9:40 pm on Jul 22, 2009 (gmt 0)

10+ Year Member



I shouldn't have said 'blinking away' ---just the stars are blinking not the whole image--- oops

jbinbpt

11:28 pm on Jul 22, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What happens if you move it inside the head tags?

And/or try this

<body background="starsbackground.gif">

celticjim

10:08 am on Jul 23, 2009 (gmt 0)

10+ Year Member



when you say 'inside the head tags' do I not already have it inside the head tags?I thought it was

and on your other point are you recommending that I remove the curly brackets:
{
background-image:url('starsbackground.gif');
}

and replace with the less than< greater than> brackets? with the ammended text?

off to try that

jbinbpt

10:56 am on Jul 23, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The head tags <head> and </head>.

Your body background follows the head tags. Move it up before the </head>.

The other suggestion was to remove the path to the image. Get rid of the http://www.example.com/

celticjim

2:06 pm on Jul 23, 2009 (gmt 0)

10+ Year Member



thx for your patience jb

it is already before the </head> tag,is it not?

I did remove the path to the image and just left it as suggested at w3schools i.e as pasted here

<html>
<head>
<style type="text/css">
body
{
background-image:url('starsbackground.gif');
}
</style>
</head>

also tried your other suggestion with the <body background="starsbackground.gif"> and nothing changed.