Why Is the Top Margin Not Showing

Q

Why Is the Top Margin Not Showing? - CSS Tutorials - Understanding Multiple Element Formatting Rules

✍: FYIcenter.com

A

If you are expecting a top margin to show up, and it is not showing up, it's probably because of the vertical margins collapsed due the following rules:

  • Between two block elements - The bottom margin of the upper element and the top margin of the lower element are collapsed into one. The taller element wins. One margin will not show up.
  • Between a parent element and a child element - The top padding of the parent element and the top margin of the child element are collapsed into one. The taller element wins. The padding or the margin will not show up.

2007-05-11, 4741👍, 0💬