If you use developer tools in your browser to inspect those elements, you’ll see that there is default margin added, which is creating the space. If you add margin-bottom: 0;
to the h1
rule, and margin-top: 0;
to the h5
rule, then the space will disappear. Change one of those 0s to get the spacing you require (e.g. 10px, 0.5em or whatever).
The <h5>
heading is incorrect here. You should not use a heading based on its default size, but in the correct hierarchical order, from h1 down to h6. Use CSS to adjust the displayed size of the heading.