Forum Moderators: not2easy

Message Too Old, No Replies

Background Image problem

css

         

eternal

11:01 am on Sep 23, 2004 (gmt 0)

10+ Year Member



I recently designed a web site where everything butted up to the left hand margin and top margin. I also used background images on the different pages, like so, changing the body tag id:

.frontpage{
background: #ffffff url(images/background1.jpg) 611px 0px no-repeat;
}
.productpage{
background: #ffffff url(images/background2.jpg) 622px 0px no-repeat;
}
.newspage{
background: #ffffff url(images/background3.jpg) 532px 0px no-repeat;
}
.casepage{
background: #ffffff url(images/background4.jpg) 517px 0px no-repeat;
}
.contactpage{
background: #ffffff url(images/background5.jpg) 533px 0px no-repeat;
}

To position the image where I wanted SUCCESSFULLLY!

Now they want to change the design so the main table is centered and this has thrown my background images out of the window. I can't seem to position them correctly now the table is centered. Netscapes' scroll bars push the design in and not the background image and I can't get it positioned correctly across the browsers any how?

I am using <table align="center"> to align the tables. Is there something else I am missing in my css code. Or is it possible to set the image to the top right of the table it should lie inside?

Not sure of the code for that or how compatable it is?

Please HELP!

thanks for your time.

jetboy_70

11:05 am on Sep 23, 2004 (gmt 0)

10+ Year Member



How about assigning the background classes to your outer table instead of the body element?

eternal

11:15 am on Sep 23, 2004 (gmt 0)

10+ Year Member



yea, that is what i am kind of hoping to do, but Im unsure how to?

Birdman

11:41 am on Sep 23, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It's pretty straight-forward. You just move the class from the body tag to the table tag.

OLD:

<body class="frontpage">
<table align="center">

NEW:

<body>
<table class="frontpage" align="center">

Birdman

eternal

1:36 pm on Sep 23, 2004 (gmt 0)

10+ Year Member



thanks, but the thing is the table already has a class! I cant apply two classes to one table can I?

humm, not sure.

jetboy_70

1:45 pm on Sep 23, 2004 (gmt 0)

10+ Year Member



Okay, your options are:

1. class="frontpage existingclass"

Put both classes on the table separated by a space. This doesn't work for Netscape 4, but is fine in any browser that doesn't suck.

2. Copy the rules from the table's existing class into all of your classes, so class="frontpage" will do do everything it did before, plus everything the existing class on the table does.

3. Wrap a div around the outside of your table, and apply your classes to that. Give it the same dimensions (if applicable) and centering code as your table, and it will 'shrink-wrap' your table:

<div class="frontpage" align="center"><table ...

</table></div>

eternal

3:20 pm on Sep 23, 2004 (gmt 0)

10+ Year Member



thats the one. Thanks guys.