How do I remove the extra space in this a element?

Someone already solved this problem for me last night but I totally forgot how CodePen works and that I have to fork other people’s code if I want to make sure I always have access to the pen. Before I realized that I had to fork it, they had already deleted the pen. Sorry to the person who helped me solve it…

Can someone tell me why there’s extra space on the right side of the a element whenever I open my website in Chrome? I managed to get rid of the extra space before I added the nav element but as soon as I added it, the extra space came back. I feel like it has to do with how the nav element interacts with the parent element or the flexbox. Please help.


<!DOCTYPE html>

    <title>The Final Spatula</title>
    <link rel="stylesheet" href="css/styles.css">
    <script src=""></script>

<body id="container">
    <header id="header">
        <nav><a class="nav-link" id="logo-link" href="#top"><img id="spatula" src="" alt="spatula"><h1>FINAL<br>SPATULA</h1></a>
            <a class="nav-link" href="#">



@import url('');
* {
    margin: 0;
    padding: 0;
    border: 0;
    font-family: 'Roboto', sans-serif;

#container {
    display: grid;
    grid-area: 100px auto 100px / 20% auto 20%;

nav {
    grid: 1 / 1 / 2 / -1;
    display: flex;
    flex-wrap: nowrap;
    justify-content: space-between;
    border: 3px solid black;
    position: sticky;
    top: 0;

#spatula {
    width: 25%;

h1 {
    display: inline-block;
    margin-right: -9999px;

a:visited {
    color: black;
    text-decoration: none;

#logo-link {
    background-color: red;
    padding: 5px 10px;

I believe i also forked that pen at the time here

It should still have the fix…

1 Like

Thank you so much! Sorry for the extra trouble… I’m going to copy and paste the solution pen onto the original post so you can delete the pen if you ever want to.