CSS sheet for background

L

Leo

I got the code for putting a background centered and no repeat. The image is in my web so I inserted the css into my html doc but nothing shows up. I renamed 'image.jpg' to the name of my image but nothing. Does the image ahve to be a certain size

I did something like this :
body
background: #fff url(image.jpg) fixed center no-repeat
 
S

Stefan B Rusynko

Should be
background: #FFFFFF url('images/dog.gif') no-repeat fixed center"

Based on your image dog.gif being in the images folder
and the current page being at same level as the images folder




| Let's do an example..my site is www.test.com and my image name is dog.jpeg. Is this what it should look like?
|
| body{
| background: #fff www.test.com(dog.jpg) fixed center no-repeat;
| }
|
 
R

Ronx

#fff is an acceptable alternative for #ffffff
Where three characters are shown, 6 characters are inferred - #abc is read
as #aabbcc

The relative path url(path/to/dog.jpg) should be OK.
--
Ron
Reply only to group - emails will be deleted unread.
message I think it would be something like this:

url(http://www.yoursite.com/yourimagefolder/dog.jpg)

and #fff - is wrong there should be 6 alphanumeric characters after the #
for the color you want.

BUT....I'm just learning this stuff too !!!


| Let's do an example..my site is www.test.com and my image name is
dog.jpeg. Is this what it should look like?
|
| body{
| background: #fff www.test.com(dog.jpg) fixed center no-repeat;
| }
|
 
J

Jon Spivey

Modern browsers take a background image as relative to the stylesheet not
relative to the page (let's not mention NN4). The way I build sites is to
have stylesheets and javascript (*.js) in a folder called scripts so a site
might look like
/root
/images
/scripts
/folder1
/folder2

In this case the background would be
background: #FFF url(../images/bg.gif) fixed center no-repeat

#fff is obviously the same as #ffffff, url doesnt need quotes - I don't know
if the order of fixed center no-repeat makes a difference. I've always done
it one way and it works.

it's a good idea to find one folder structure you're comfortable with and
stick to that for every site
 
J

Jon Spivey

As Ron pointed out fff is the same as ffffff - web safe colours always
follow the same format 2 digits 2 digits 2 digits so we can abbreviate them.
I'm not too fussed about web safe any more - to my mind it was only relevant
when you could buy a PC with a 256 colour display.

By the way I clicked a site you did the other day - something about
dancers - and thought it was a very good job :)

--
Cheers,
Jon
Microsoft MVP - FP

url(http://www.yoursite.com/yourimagefolder/dog.jpg)
is perfectly OK, and pretty much essential if you want nn4 support, the
only problem is you wouldn't be able to view your site locally unless you're
 
C

Cheryl Wise

There can be a problem with relative paths . Netscape 4.x improperly
resolves the line from the html page not the stylesheet. Better to use
either absolute or not relative links.

--
Cheryl D. Wise
MS-MVP-FrontPage
[email protected]


i'm still learning css myself, but i think relative url is ok.


| where it says url I should put www.domain.com/images? So if I have my page
set to display at 100% regardless of screen resolution, my background image
should be at what size? At least 800 x 600?
 
Top