|
| |
|
|
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 pagequote:
<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
|
|
|
|
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?
|
|
|
|
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
|
|
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
|
|
|