navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

Microsoft MVP

 

Background Image

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> Cascading Style Sheets >> Background Image
Page: [1]
 
Donkey

 

Posts: 3869
Joined: 11/13/2001
From: Blackfield United Kingdom
Status: offline

 
Background Image - 7/13/2003 11:19:49   
I' m just starting to learn CSS, following the About.com course and one from webmonkey.
About.com CSS Course
Webmonkey CSS Guide

I' m working through each part on a small test site (only on my computer not published).

Up to now it' s seems easier than I thought it would be, but I can' t get the background image to work. I can change the background colour by creating e.g. body.green and body.red on the stylesheet and then selecting them on my test page. But body.image won' t work either in IE6 or Netscape 4.6. It' s driving me crazy - I' ve been stuck on this for 2 hours now- could somebody please tell me what I' m doing wrong?

This is what I' m using on the stylesheet.
quote:

body.image {
background-image: url(CSS_Test/images/image.jpg);
background-position: center;
}


And on the page
quote:

<body class=" image" >

</body>


Thank you in anticipation.

Peter
Gil

 

Posts: 7533
From: North Carolina, USA
Status: offline

 
RE: Background Image - 7/13/2003 12:36:03   
quote:

<body class=" image" >


body class=" .image"

_____________________________

Gil Harvey, 1947-2004

(in reply to Donkey)
Donkey

 

Posts: 3869
Joined: 11/13/2001
From: Blackfield United Kingdom
Status: offline

 
RE: Background Image - 7/13/2003 13:28:50   
Thanks Gil,
But it still won' t work.
I can' t get a background image behind a paragraph either, and now I' ve got on to playing with boxes/margins borders etc. I can' t see the borders either.

Is there something basic that I have missed?

(in reply to Donkey)
gorilla

 

Posts: 2974
From: Denmark
Status: offline

 
RE: Background Image - 7/13/2003 14:29:26   
body.image {
background-image: url(CSS_Test/images/image.jpg);
background-position: center;
}

Take the .image out of the body selector and see what you can see :)

Freya.

Grand high matriarch and puissant panjandurum of the silverback gorilla tribe.

Thought for the day: An alpha female equipped with the keys to her own banana plantation and a rolling pin will always have the attention and respect of the alpha males of the tribe.

Copenhagen
Denmark
July 13th 2003

_____________________________

Mháircaish

Signature self-censored to protect the sensibilities of the thin-skinned :).

May we never confuse honest dissent with disloyal subversion. – Dwight D. Eisenhower



(in reply to Donkey)
Donkey

 

Posts: 3869
Joined: 11/13/2001
From: Blackfield United Kingdom
Status: offline

 
RE: Background Image - 7/13/2003 14:55:59   
I tried that and it made no difference.
But I' ve just put the test page into dreamweaver (I was using notepad) and when I checked the code after using the dreamweaver window to create the background.image style rule it had put in the following.

quote:

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



And it works! Wonderful, it' s like a religious experience, I can now nearly move on..
but to give me closure on this can anyone explain why the two dots before the first slash aren' t mentioned in the tutorials or any of the posts about background images that I have been reading here on the forum? Is it that I am so thick (dumb in American) that I don' t understand that the two dots are always put there anyway? or as I suspect <paranoid>does everyone else get away with not using them?</paranoid>

Thanks for your help so far.
Peter
Who is now going offline for a while to try and have a life for an hour or so:)

(in reply to Donkey)
gorilla

 

Posts: 2974
From: Denmark
Status: offline

 
RE: Background Image - 7/13/2003 16:02:06   
Ah....... I think a tutorial about relative and absolute URLs might be in order.


There are two standard ways to create links:

1 Absolute paths
2 Relative paths

Absolute paths are called that because they refer to the specific location of the resource in questioon, including the domain
name, where it is in the directory structure, and the exact name and extension of the resource in question.

Thus:

http://www.foo.com/foobar/images/foobar.gif


However if you' re referring to a Web element that is on the same domain that you' re on, you can use a relative url. That is you can drop the domain name.

Thus:

/foobar/images/foobar.gif

To avoid grief it is usually sensible to use absolute paths, (without the domain name,) on most Web sites. This format insures that the resource will be referencable no matter where you place the page.

If you share code, (which is what a lot of sites that use external style sheets are doing) across pages and directories on your site, using absolute paths will speed up your maintenance. Otherwise you run the risk of confusion from being in a maze of twisty little urls all alike.

Relative Paths

A relative path will change depending upon the page upon which the links are located. It can get tricky.

There are several rules that you need to remember:

1. If the link is to a resource in the same directory as the page no path information need be listed.


2.filename sub-directories (down one directory) are listed without any preceding slashes


images/donkey1.gif

foobar1/trottingdonkey.gif


3.links that are up one directory are listed as

../filename.

So how do you do it?

How to determine the relative path:

1.Work out the location of the page you are editing.

2.Work out the location of the resource you want to link to.

3.Compare the two locations and to decide how to point to it

4.Write the link.

Still stuck? A relative URL is always a local URL. The first part is therefore always the same as that of the current URL.

The relative URL is then turned into an absolute local URL with these steps:

1.Omit the filename of the current absolute local URL, if it' s not a directory URL.

2. For every ../ at the beginning of the relative URL, chop off one directory name from the current directory URL. (going UP the directory tree in other words.)

3.Append the local URL to the current one.

Now take one of these pink tablets. Why? ..... Because it' ll calm you down after wrapping your poor braised OOPS I meant bruised ... bruised ... not braised at all .... bruised bruised ..... now now .. there' s no need to back away from me like that ... stop being paranoid ... banana oil and extract of GM Thistles if you must know ... Very healthy and good for donkeys ..... What do you mean you' ve read Shakespeare and there' s " no way you want to be ill met by some crazed gorilla wearing a crown by moonlight" ....oh all right don' t stop being paranoid ... yes all right I admit it I am out to get you .... muhaha. :)

I hope this helped a little :-)

F

< Message edited by gorilla -- 7/13/2003 5:08:40 PM >


_____________________________

Mháircaish

Signature self-censored to protect the sensibilities of the thin-skinned :).

May we never confuse honest dissent with disloyal subversion. – Dwight D. Eisenhower



(in reply to Donkey)
Donkey

 

Posts: 3869
Joined: 11/13/2001
From: Blackfield United Kingdom
Status: offline

 
RE: Background Image - 7/13/2003 19:41:40   
I think I see...
Because I have only been " playing" with an unpublished test site I can only use relative links unless I put in the full path starting at C:/.

Hee Haw! you Gorillas are clever people... must be the opposable thumb:)

Anyhow it' s as if a light has come on in my poor old donkey brain, and I thank you very much for your help.

BTW Can I have a few more of those pink pills, they really hit the spot.

Thanks
Peter

(in reply to Donkey)
Page:   [1]

All Forums >> Web Development >> Cascading Style Sheets >> Background Image
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts