|Monte on Nov 28, 2010 at 4:25:02 AM (# 1)|
H1 is "inline", whereas P is a "block level" element.
The DIV is also a "block level" element.
All three rules are applied. They are simply applied based on the element they are in. Put borders around your elements to see what's going on.
And check out www.w3c.com for CSS tutorials. They will help you much more than I can.
MHenke on Nov 29, 2010 at 3:20:46 AM (# 2)
H1 is also block-level. 8)
The red "in the middle" are the default margins (bottom/top) of the H1- resp. DIV-element. You see no red on left/right because there're no default margins.
Try to set the margin to 0 and you'll see no red at all.