Hey guys, this is probably something really easy and super basic/simple but I just don't know how to fix it. When I drop the margin on a div inside of the <content> div, the <content> div drops as well. Problem: http://img43.imageshack.us/i/halpme.png/ if it doesn't show CSS: body { background: #432b1b; } #container { width: 800px; margin: 0px auto; } #header { background: url(images/img_03.png); height: 156px; } #content { background: #f3f3f3; width: 800px; } #img1{ background: url(images/img_09.png) no-repeat; height: 174px; width: 200px; margin-top: 25px; } #footer { background: url(images/img_17.png); height: 201px; width: 100%; } Code (markup): HTML: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>Test Theme, Sir.</title> <link href="base.css" rel="stylesheet" type="text/css"/> </head> <body> <div id="container"> <div id="header"></div> <div id="content"> <div id="img1"></div> <div id="txt1"></div> </div> <div id="footer"> </div> </div> </body> <html> HTML: I'm going to sleep so hopefully there'll be a response by morning. Thanks in advance.
Perhaps I should have been clearer. What I meant was, I need the div with the id "img1" to drop down 25 pixels, but I don't want the div with the id "content" to also drop down. <div id="content"> <div id= "img1"></div> </div> HTML: #content { background: #f3f3f3; width: 800px; } #img1{ background: url(images/img_09.png) no-repeat; height: 174px; width: 200px; margin-top: 25px; } Code (markup): For some reason, the margin-top: 25px; not only drops the img1 div, but it also drops the content div. The rest of the HTML/CSS are in the original post if it's something there.
try using padding, instead of margins. I have the same problem when putting info inside a certain div.
Another 2 ways of looking at it: 1. Replace the #img1 padding:25px with a border-top: 25px... or 2. Wrap the #img1 with another DIV and add the 25px padding to that new div.
I'd use top-padding on the #content box to push things inside down. What you are getting right now is actually correct. Google "margin collapse". One of the things with margin collapse is parents can get their children's margins, which is what's happening here (your #img1's top margins are being given to the #content box). Margin collapse can be stopped with an application of just 1px of padding, so if you don't want everyone inside #content to be pushed down as far as #img1 then try giving #img1 just one pixel of padding. This might not look good to you so I think you could also try the 1px on #content instead. Just top-padding since the top is where the margins are collapsing. BTW I'll bet Ursula Vernon would think your avatar is super neat-o : )