Background Image in a CSS

liunx

Guest
Hey everyone, it's been a very long while since I joined. In fact, this might even be my very first post (I didn't look at my profile to see if I ever posted here yet or not).

Anyways, straight to the point.

I am currently using Dreamweaver MX (not 2004, just MX). I have GoLive CS but I cannot stand it being that Dreamweaver is so much easier to understand and learn.

I created a template in Photoshop CS for my webpage that is 800x800.

I have this content box that I attached an iframe to. This content box has a background image, not just color.

I created a seperate html document that contains a news story. I have no problem displaying the news story in the iframe but the problem I have concerns the background. In the news story html document, I only did normal text formatting, not touching anything to do with the background. When the user clicks on the link to display the news story in the iframe window, instead of seeing just the formatted text, the user will see that the text sits in a white cell.

So I then attempted to learn CSS. I have managed to figure out the basic CSS coding, such as the font-size, font-weight, font-style, etc... What I have not been able to figure out is how to set a background image. I would also like for this image to be a fixed image. The current book I am using to learn from is "HTML, XHTML, and CSS Bible". The book is working wonders on my coding but for the life of me, I cannot seem to figure out how to add the fixed background image.

Here is the code I am currently using in my external "mainpage.css" is as follows:

body { background-image: url("contentbox_background.gif"); background-repeat: no-repeat; }

Is there anything I am doing wrong with the coding? That is exactly what I am typing into the style sheet.Please try the following


body {
background-image: url("contentbox_background.gif");
background-repeat: no-repeat;
background-position: 50px 50px;
background-attachment:fixed;
}


The background-position values can be top, center, bottom, left, center, right depending on how you want to position the image.

background-position: center center

or a numerical value as shown aboveThank you.

Sorry for such a late reply back. I work the midnight shift at my job.

So far it isn't working though.

I have the contentbox_background.gif in the images folder. Do I need to put "\images\contentbox_background.gif" rather than just contentbox_background.gif?

What is the purpose of putting url in front?Nevermind now. I finally figured it all out. I have it working and it looks how I was wanting it to the whole time.
 
Back
Top