Jump to content

my background doesn't want to repeat-y


Recommended Posts

body {

margin: 0;

text-align: center;

font: 0.8em verdana, arial, sans-serif;

line-height: 170%;

color: #FFF;

background: #585858 url(bg2_bady.jpg) repeat-y;



is this the test site?


anyway, my background doesn't want to show at all with this code, only the color gray, and if it take the color away I only sit with a white page.


thank you.

Link to comment
Share on other sites

There's nothing wrong with that code. The image file bg2_bady.jpg needs to be in the same folder/directory as your html file.


We need to see all your code and styles because the problem may be somewhere else; for instance a background in another element covering up the body background.

Link to comment
Share on other sites

I just tested this, and it should be fine -- it worked correctly when I added my own image, repeating down the y axis, and also across the x axis when I changed the CSS. Is the "bg2_bady.jpg" image spelled correctly? Do the file names in both the actual JPG file and in the CSS match? And the image is in your wamp's www directory?


One other comment... In your CSS, the hash symbol "#" indicates that you are referencing a id, rather than a class. However, you don't need that hash symbol in your HTML. You should be using:


Link to comment
Share on other sites

Folder structure is important too. Your images should be in their own folder on root level. And really so should your style sheets. When you open the www dir folder you should see all of your pages html/php a folder for images and a folder for styles.


That being said you'll need to update your links to reflect the new structure. Like your

link to the style sheet and all of your images will need updated as well.


Thats a good practice. It will help in the long run to be organized.


I'm not sure about php... But in html it is not neccessary to add the pound sign (#) in the div value.




should be


You still need it in the style sheet. Thats how it is identified as an id(#) or a class(.)

Link to comment
Share on other sites

Another thing: make sure that the image filename is lower case; the case must be the same in the code as in the actual filename.


and these lines


meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />



have /> as the closing tag which is correct for XHTML but you have a HTML doctype so the lines should be:-


meta http-equiv="content-type" content="text/html; charset=iso-8859-1">


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...