Previous Message
Next Message

Removing border makes background image move to unwanted places

Sent by Zoe M. Gillenwater on 24 August 2004 13:01


Øyvind Bø wrote:

> http://www.inkognito.no/coop-no/bannere/mega_tilbudsbanner/index.html
>
> And it looks fine in most browsers, even IE!
>
> The problem is that once I remove the border on the container div, the 
> background image moves to places I don't want it to be.
>
> Like this:
> http://www.inkognito.no/coop-no/bannere/mega_tilbudsbanner/noborder.html
>
> This happens in Gecko browsers, Opera and Safari so I'm starting to 
> think I've done something terribly wrong :-)


You are experiencing margin collapsing.  Without that border, the margin 
of your #produkt box touches the margin of the page and collapses 
together with it, so #produkt is no longer pushed down 110px.  You could 
set a 1px border the same color as your background on the top of your 
container, or set 1px of padding there.  Or, you could move that box 
down using absolute positioning rather than margin, but keep it mind the 
container would need to be set to position: relative for this to work.

Read more about margin collapsing here:
http://www.andybudd.com/archives/2003/11/no_margin_for_error/

Zoe

-- 
Zoe M. Gillenwater
Design Specialist
Highway Safety Research Center
http://www.hsrc.unc.edu

______________________________________________________________________
css-discuss [EMAIL-REMOVED]]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
Previous Message
Next Message

Message thread: