does not work I am trying to create a set of links to specific sections of...">

<a href= "https://stackoverflow.com/#..." rel="nofollow noreferrer"> does not work

I am trying to create a set of links to specific sections of a page using notation <a href="#...">, but it does not work. Clicking on the link does not seem to do anything, and right-click -> open in a new tabchanges the URL, but does not move to another section of the page. I am using Firefox 28.0. My links are as follows:

<div>
    <p>Contents</p>
    <ul>
        <li><a href="#map">Map</a></li>
        <li><a href="#timing">Timing</a></li>
        <li><a href="#timingdetails">Timing Details</a></li>
    </ul>
</div>

And they should be related to:

<div id="map">[content]</div>
<div id="timing">[content]</div>
<div id="timingdetails">[content]</div>

Links to external web pages work great. Placing a function id="..."inside a tag <a>instead did not fix the problem. The URL of my webpage is in the form http://127.0.0.1/foo/bar/baz/. This is in the Python Django project.

Any idea why this is not working?

+4
5

href , name id href ( # ). .

<a href="#map">Map</a>

<a name="map">[content]</a>

div , .

+3

, , OP. -, Mozilla Firefox id HTML , <a>, name, Google Chrome . :

1. divs a name, id, . , :

<a href="#map">Go to Map</a> <!-- Link -->
----
<div id="map" name="map"></div> <!-- actual anchor -->

: http://jsbin.com/feqeh/3/edit

2. <a> name .

.

+1

, , href does not work second time , Remove hash ,

, .

<a href="#1" onclick="resetHref();">go to Content 1</a>

function resetHref() {
    location.hash = '';
}
+1
<a href="#1">Content 1</a>    
<a href="#2">Content 2</a> 
<a href="#3">Content 3</a>
....
<a name="1"></a>Text here for content 1
<a name="2"></a>Text here for content 2
<a name="3"></a>Text here for content 3

" 1" " 1. !

-1

, , , IE, Chrome Firefox.

Around any text, create an anchor tag as follows:

<a class="anchor" id="X" name="X">text</a>

Set “X” to whatever you want.

You must enclose something in anchor tags, such as text or image. He will not work without them.

For reference, use the following command:

<a href="#X">text</a>

As for getting rid of CSS for links using our anchor tag, use something like this:

a.anchor {
color:#000;
text-decoration:none;
}

This seems to work well.

-2
source

Source: https://habr.com/ru/post/1537979/


All Articles