nickburrett
10-22-2010, 12:29 AM
I'm developing a basic website for my partner but I'm having some problems with a margin.
<div class="layer1">
<div class="layer2">
<div class="layer3">
<div class="layer4">
<p>I don't understand what's going on here. The margin on layer4 is affecting layer1, layer 2, and layer3?</p>
<p>They grey border above should line up with the grey border on the right, and the text here should have a 20px margin from the top border</p>
<p>More content goes here. More content goes here. More content goes here. More content goes here. More content goes here. More content goes here. More content goes here. More content goes here. More content goes here. More content goes here. More content goes here. More content goes here. More content goes here. More content goes here. More content goes here. More content goes here. More content goes here. More content goes here. More content goes here.</p>
</div>
</div>
</div>
</div>
.layer1 { background-image: url(template_images/topmiddle.gif); background-repeat: repeat-x; background-position: top; }
.layer2 { background-image: url(template_images/topleft.gif); background-repeat: no-repeat; background-position: left top; }
.layer3 { background-image: url(template_images/topright.gif); background-repeat: no-repeat; background-position: right top; }
.layer4 { margin: 20px; }
My question is, why does the layer4 margin affect layer1?
helenquartley.html (http://www.helenquartley.co.uk/new_template/helenquartley.html)
<div class="layer1">
<div class="layer2">
<div class="layer3">
<div class="layer4">
<p>I don't understand what's going on here. The margin on layer4 is affecting layer1, layer 2, and layer3?</p>
<p>They grey border above should line up with the grey border on the right, and the text here should have a 20px margin from the top border</p>
<p>More content goes here. More content goes here. More content goes here. More content goes here. More content goes here. More content goes here. More content goes here. More content goes here. More content goes here. More content goes here. More content goes here. More content goes here. More content goes here. More content goes here. More content goes here. More content goes here. More content goes here. More content goes here. More content goes here.</p>
</div>
</div>
</div>
</div>
.layer1 { background-image: url(template_images/topmiddle.gif); background-repeat: repeat-x; background-position: top; }
.layer2 { background-image: url(template_images/topleft.gif); background-repeat: no-repeat; background-position: left top; }
.layer3 { background-image: url(template_images/topright.gif); background-repeat: no-repeat; background-position: right top; }
.layer4 { margin: 20px; }
My question is, why does the layer4 margin affect layer1?
helenquartley.html (http://www.helenquartley.co.uk/new_template/helenquartley.html)