Help CSS positioning background
- Started
- Last post
- 5 Responses
- mobius
I'm having trouble aligning a background with a table.
it seems to look fine on firefox. but somehow its not align properly in IE.
maybe someone could have a quick look at my code and how can i fix this issue?
much appreciates.
- mg330
get rid of the table. use a div.
- blackspade0
just use a div with margins set to auto so its centered
- Terminal270
table and css div hybrids are a real bitch to make work.
I agree... use a div instead of a table
- thismanslife0
I agree with all the comments about using div's in general... however, this probably wont fix your problem in this case. I assume you're talking about the vertically tiling background image of white on blue with a slight shadow, not aligning horiztontally...?
This is caused by IE handling background centering and content centering differently. You have to use certain values to get the to marry-up in IE. I can never remeber what this is, but it's something like, using even numbers for your widths (of the centered content and of the background image)... or something like that....
To fix yours...
You probably need to put a hack in to enable a different bit of CSS for IE. Try playing with adding a 1px margin to the right or left of your table or making it 1px wider/smaller, if you can... (or, better still, make it a div and try these things). It "wiggles" in and out of alignment by 1 pixel as you resize the window, so check it at different sizes. You could also try adding 1px onto the right or the left of the background image, and having two versions, one for IE and one for FF.Hope that makes sense.
- Stugoo0
I would use a div with auto margins and relative positioning to get the page centered.
slap the bg image in that div and give it padding so you can fit in the content.
stick another div in there and put your content in in it.