Backround-image not appearing (Full Version)

All Forums >> [Web Development] >> Cascading Style Sheets



Message


Nessie -> Backround-image not appearing (2/7/2006 10:49:19)

I am new to CSS and am using Frontpage 2000 to build a site on a private intranet. I have created an external css file using notepad and imported it into FP2000 to add a background image but its not appearing in either normal or preview screens. The image is stored in the webs images folder. I have created another css file which works and both have been linked to the page. I can insert the background using FP but thought it would be better to use css. In my head tags I have typed:

<style type="text/css">
body{background-image: url ('../images/logo.jpg)}
</style>

I have tried changing the image address to include full file location and also moved it to the same location as the css file but all have been unsuccessful.




rdouglass -> RE: Backround-image not appearing (2/7/2006 11:02:12)

quote:

body{background-image: url ('../images/logo.jpg)}


body{background-image: url ('../images/logo.jpg')}

(See it?)

EDIT: Hi and Welcome to OutFront. [;)]




Nessie -> RE: Backround-image not appearing (2/7/2006 11:11:53)


quote:

ORIGINAL: rdouglass

body{background-image: url ('../images/logo.jpg')}

(See it?)


Oops, that was a typing error, I have included ' marks at either end of my url link.

Well spotted!




rdouglass -> RE: Backround-image not appearing (2/7/2006 11:28:09)

quote:

I have included ' marks at either end of my url link.


Does that mean that fixed it or you just posted it wrong? [8|][;)]




Nessie -> RE: Backround-image not appearing (2/7/2006 11:44:13)


quote:

ORIGINAL: rdouglass

quote:

I have included ' marks at either end of my url link.


Does that mean that fixed it or you just posted it wrong? [8|][;)]


I wish it was that simple, unfortunately it was a typing error in my post both quotes are in my css file![8|]
Thanks for your input




rdouglass -> RE: Backround-image not appearing (2/7/2006 13:02:58)

Is this a Windows 2003 host server?

Can you look at this link for a simple CSS to do background images?

http://www.w3schools.com/css/tryit.asp?filename=trycss_background-image

Also, IIRC with CSS and external sheets, the path is relative to the CSS file and not the page that it is incuded on. Is this an external CSS?




rdouglass -> RE: Backround-image not appearing (2/7/2006 13:05:23)

quote:

url ('../images/logo.jpg)}


Also try removing the space between url and the paren.




Nessie -> RE: Backround-image not appearing (2/8/2006 6:42:26)

Thanks for your replies,
I have been to that website already and copied the code straight into my external css file which is linked to my html page in the head tag with:
<link rel="stylesheet" type="text/css" href="background_css.css">
I have tried removing spaces which also doesn't work, and also simply changing the background color without inserting image:
body {background-color: red}.

It is seeing the css file because it will let me change background color of text but not the page [sm=ask.gif]




Tailslide -> RE: Backround-image not appearing (2/8/2006 7:00:45)

Nessie, can you give us a link to have a look - much easier to fix it then!

I'd also get rid of the single quotes all together.

Have you tried fiddling with the path to the image at all? If the CSS file is in the same folder as your HTML document and the images are in a folder within that directory then the path should be:

background-image: url(images/yourimage.jpg);




Kitka -> RE: Backround-image not appearing (2/8/2006 7:01:44)

quote:

It is seeing the css file because it will let me change background color of text but not the page


Are you certain you have the path to the image correct? Might it possibly be:

 body {background-image: url("images/logo.jpg")} 


I also noticed the code you quoted in an above post, has no space between "body" and opening curly parenthesis - try it with a space.

What OS are you using? I have noticed that often Macs require the quotation marks round the url, instead of apostrophes. That is worth testing.




Nessie -> RE: Backround-image not appearing (2/8/2006 7:28:29)

Unfortunately I can't post the url because it will be located on an intranet and is also just in the development stages at the moment. I have tried changing the url address to ../images/logo.jpg & images/logo.jpg & logo.jpg and with quotes, double quotes, no quotes and removing/adding spaces, but still no luck. Although I would still expect it to let me change the background color without an image.
Would I be better to just insert the background using Frontpage page properties and inserting background. I was just trying to improve the performance before it goes live.




Tailslide -> RE: Backround-image not appearing (2/8/2006 7:56:52)

You could try this:

body {background:#fff url(../images/logo.jpg) top left no-repeat;}


With the #fff being whatever background colour you want. I'm assuming a background position of top left but it could be stated in terms of pxs too.

It will work - sometimes it just takes a bit of fiddling to work out what it is that the page doesn't like.




Nessie -> RE: Backround-image not appearing (2/8/2006 9:15:19)

Just managed to get the background to show by embedding the style into the html of the page but still can't get it to work through the external css even though the css file, html file and image are all stored within the root folder.




d a v e -> RE: Backround-image not appearing (2/8/2006 9:29:13)

try using topstyle lite ( http://www.bradsoft.com/download/ ) to handle your external stylesheet and see if that helps - you can just browse to the image and it should work fine




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.078125