Problem offset div

Hello everyone,
In fact I have a little problem in image html, I created two div, one is

inside the other.
When I put the border to 1px, I can see both, but when I

removes
the border or I put it to 0px, the top margin he walks over.
Here is the link to my online page:
http://www.mestestes.eu/
Thank you for your advice

Résolu :slight_smile:

I see that you have set top margin for both div’s? This is what they call collapsing margins. When the vertical margins of two elements are touching, only the margin of the element with the largest margin value is counted. Adding a border or using a 1 px padding on the parent solves this issue.

For you the solution will be to change the height for the parent to 199px and add a 1px padding at the top


<div  id="1" style="width:798px ; height:199px ; border:0px red solid ; margin-top:25px ; padding-top 1px; background-image:url(images/fond_central.png)">


<div  id="2" style="width:776px; height:176px  ; border:1px red solid ; margin-left:10px ;margin-top:10px">

</div>

</div>

You just did :wink:

Donbo thank you for your reply.

I replaced “padding-top 1px;” with “padding-top: 1px;” and it works well
how can I put solved?