How do I affect the gap between two h-elements?

How do I affect the gap between two h-elements?


In this pen here:

See the Pen temp1 by Akshay Anand (@arcinglight) on CodePen.

I have an h1 element and h3 element. There is a gap between these two elements that appears, which is different from that gap that would occur between two lines of text, either plainly in the body or within a P element. Why is this and how can I affect the gap? Is this gap the same gap that would be rendered between separate elements? Is there a way to affect the gap only between a certain set of/ two particular elements?


By default, all h1 to h6 elements and paragraph(p) elements have a margin at the top and bottom of it

ul elements have a default padding to the left and margin at its top and bottom

You need to remove that margin by setting it margin: 0;


Thank you! I was a bit confused by gaps appearing in my projects. I should have checked if there was a default style!


Use dev tools for checking those.