Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.


    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

Help with removing space in <h1>

MrRobotBDR

New Coder
What is responsible for all the whitespace around the text in this <h1>?

It's so big it's almost acting as a margin-top.

To view this content we will need your consent to set third party cookies.
For more detailed information, see our cookies page.
View: https://imgur.com/bTUg9uR


HTML:
<section class="contact-hero">
    <h1>Contact us...</h1>
    <p>Write us a brief, ask us a question or tell us what you’re looking for in your own words.</p>
</section>

SCSS:
.contact-hero {
    width: 100%;
    text-align: center;

    h1 {
        font-family: $ff-h1;
        font-size: 128px;
        margin-bottom: 30px;
    }

    p {
        font-family: $ff-p;
        color: $off-black-grey-p;
        margin-bottom: 70px;
    }
}
 
Last edited by a moderator:
Heading elements do, by default, have top and bottom margins:
1706970012511.png

You can set margin-top: 0; on the h1 element to remove that top margin.

There will still be a little bit of spacing at the top and bottom, which if you don't want, can be removed by reducing the line height.
 

New Threads

Buy us a coffee!

Back
Top Bottom