raman kadam wrote:
1. I understood that the default setting in H1 is causing a gap in the top section.However, I fail to understand how ' padding:1px ' can solve it.
Without the padding, the background color is only being applied to where actual content is, and that is behind the h1. when you add padding, the entire header is considered to have content, so the background applies to the whole header. It is kinda weird, but that's how it works.
2. Does it mean padding is replacing margin here ?
No. See above. The margin is still there. All the padding affects is the background color of div.header.