Why are these divs repelling each other?

Posted by Terminal Frost on Stack Overflow See other posts from Stack Overflow or by Terminal Frost
Published on 2010-05-20T03:25:35Z Indexed on 2010/05/20 3:30 UTC
Read the original article Hit count: 219

Filed under:
<html>
 <div style="width:200px;">
  <div style="background:red;height:5px"></div>
  <div style="background:yellow">
   Magnets?
  </div>
  <div style="background:green;height:5px"></div>
 </div>
</html>

Rendering with "Magnets?" wrapped in h3 tags

How come the divs cease to be contiguous if "Magnets?" is wrapped in a paragraph or heading tag?

© Stack Overflow or respective owner

Related posts about div