Skip to content Skip to sidebar Skip to footer

Margin Doesn't Work? Need Space Between Two Elements

First of all, I do apologize I don't put my link here, it's a site for work and I'm not allowed. I'll post the relevant parts of my code if necessary though. So the problem is pret

Solution 1:

You can try 2 things:

1) Put the elements overflow:hidden

2) put the elemnts display:block

If number 2 messes up with your design, try putting them float:left;

Since I don't have the code I can't give you more information, but when margins/paddings do not work, it is usually because you are either applying it to an Inline item (hence number 2) or you have a container where everything inside is floating, so the container won't have the proper height (hence number 1)

Solution 2:

Sounds like margin collapse. Here are a couple of ways you could solve this:

Give your content div a transparent border or give your content div the css declaration of overflow: auto;

Some people when they give it a 1px border they also give it a -1px margin to counter the border.

Post a Comment for "Margin Doesn't Work? Need Space Between Two Elements"