Achor tag not working

Hi everyone. I’m learning HTML by myself.

I’m creating this post because I created a ‘achor’ tag and i want it to go into specific part of the website but when I run live server it doesn’t do that.

I have no error on my code.

Can you help me? Thank you!

<!DOCTYPE html>

<html lang="en">

    <head>
        <meta charset="UTF-8">
        <meta name="author" content="João Barbosa">
        <meta name="description" content="This is a page about HTML.">
        <link rel="icon" href="icon_html.png" type="icon/x-icon">
        <link rel="stylesheet" href="main.css">
        <title>This is a title</title>
    </head>

    <body>
        <h1>Hello World!</h1>
        <p>This is my first paragraph.</p>

        <a href="#html3">Go to: h3</a>

        <hr>

        <h2>Hello World again!</h2>
        <p>This is my second paragraph!</p>

        <hr>


        <section id="#html3">

        <h3>Hello for the third time!</h3>

         </section>

        <ol>
            <li>First content.</li>
            <li>Second content.</li>
            <li>Third content.</li>
        </ol>

        <ul>
            <li>First content</li>
            <li>Second content</li>
            <li>Third content</li>
        </ul>

        <hr>

        <a href="https://forum.freecodecamp.org/">Free Code Camp link</a>

        <hr>




    </body>

</html>

Hi @JoaoBarbosa and welcome to our community!

Whilst you include the hash(#) in the href attribute as an anchor pointing to an element on the same page, you do not include the hash in the id attribute.

Hope that helps!

Thank you for your reply!

It worked!

1 Like