I'm trying to use margin-top: 90px but it's not working. It worked on the others but it's not working on this one. What should i do?

  • Give us a link to us to look at. Or at least some sample code. Ben Shoults about 10 years ago
  • @canyonchase1 Can you update your question with a link, please? We'll need to close this question otherwise. Matthew Brindley about 10 years ago

3 answers

danwellman 5600
This was chosen as the best answer

Is there a floated element near by? Floats can mess with flow problems like margin not working.

Answered about 10 years ago by danwellman
  • yeah. your right. thx i fixed it canyonchase1 about 10 years ago
  • cool :D danwellman about 10 years ago

As Dan mentioned, floats can affect margins in this way. To solve it, add:

clear: left;

To the link with the top margin. That will make it "clear" the element above it, and then the margin will take effect.

Answered about 10 years ago by Paul Farnell

Without seeing any example code, I can only offer the following insight.

Links, <a> tags, are inline elements by default. Only the left and right margins on inline elements get applied, top and bottom margin are ignored. (Same applies to padding on inline elements). You can override this in a number of ways: changing the display of the element to block or inline-block (inline-block is poorly supported in older versions of IE and Firefox), or putting your link inside a block element and setting the margin on the block element.

I tried to find you a good reference online. This is the best I could find about block vs. inline. It's probably more information than you need but it's a good article: http://www.autisticcuckoo.net/archive.php?id=2005/01/11/block-vs-inline-1

Answered about 10 years ago by Eli Cochran