Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML Anchor Jump Doesn't Work

Tags:

html

css

anchor

The title means what it says. when i setup a link to jump to a certain div it doesn't work. For example when i say <a href="#Section1>Section 1</a> and click it, it should jump to the anchor tag with the name of 'Section1' <a name="Section1"></> but nothing happens.

<main id="Main">
    <div class="Container">
        <div class="Section-Links Left Box-Sizing">
            <div class="Links">
                <a href="#test">Test Post</a>
                <a href="#test2">Test Post</a>
                <a href="#test3">Test Post</a>
                <a href="#test4">Test Post</a>
                <a href="#test5">Test Post</a>
                <a href="#test6">Test Post</a>
                <a href="#test7">Test Post</a>
                <a href="#test8">Test Post</a>
                <a href="#test9">Test Post</a>
                <a href="#test10">Test Post</a>
            </div>
        </div>
        <div class="Sections Left Box-Sizing">
            <div class="Section">
                <a name="Test"></a>
                <span class="Section-Title">Test Section</span>
                <p class="Section-Text">Some Random Words Here.</p>
            </div>

            <div class="Section">
                <a name="Test2"></a>
                <span class="Section-Title">Test Section</span>
                <p class="Section-Text">Some Random Words Here.</p>
            </div>

            <div class="Section">
                <a name="Test3"></a>
                <span class="Section-Title">Test Section</span>
                <p class="Section-Text">Some Random Words Here.</p>
            </div>

            <div class="Section">
                <a name="Test4"></a>
                <span class="Section-Title">Test Section</span>
                <p class="Section-Text">Some Random Words Here.</p>
            </div>

            <div class="Section">
                <a name="Test5"></a>
                <span class="Section-Title">Test Section</span>
                <p class="Section-Text">Some Random Words Here.</p>
            </div>

            <div class="Section">
                <a name="Test6"></a>
                <span class="Section-Title">Test Section</span>
                <p class="Section-Text">Some Random Words Here.</p>
            </div>

            <div class="Section">
                <a name="Test7"></a>
                <span class="Section-Title">Test Section</span>
                <p class="Section-Text">Some Random Words Here.</p>
            </div>

            <div class="Section">
                <a name="Test8"></a>
                <span class="Section-Title">Test Section</span>
                <p class="Section-Text">Some Random Words Here.</p>
            </div>

            <div class="Section">
                <a name="Test9"></a>
                <span class="Section-Title">Test Section</span>
                <p class="Section-Text">Some Random Words Here.</p>
            </div>

            <div class="Section">
                <a name="Test10"></a>
                <span class="Section-Title">Test Section</span>
                <p class="Section-Text">Some Random Words Here.</p>
            </div>
        </div>
        <div class="Clear"></div>
    </div>

    <p class="Footer-Masthead">Created By Moussa Harajli.</p>
</main>

if you would like to test this go here. http://67.184.73.19/Projects/Assassins/rules.php

like image 556
Moussa Harajli Avatar asked Jul 31 '26 13:07

Moussa Harajli


1 Answers

Anchor links doesn't point to names but to ids

so change for example:

<a name="Test7"></a>

to:

<a id="Test7"></a>

And you should not change the capitalization of the ids in the id attribute and the links.

like image 130
idmean Avatar answered Aug 02 '26 07:08

idmean



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!