Home > Software engineering >  Link to a specific part of a web page doesn't work [duplicate]
Link to a specific part of a web page doesn't work [duplicate]

Time:09-28

I created a website with en explore button code of the button:

  <a href="#sec" id="exploreBtn">Explore</a>

I liked it to this article

<article class="sec">

but when I press the button knowing happens

CodePudding user response:

The article should have id sec like the below piece of code, but you have written class sec.

<article id="sec">

CodePudding user response:

As you have called id sec in a tag not the class so you must have sec as id of your article tag
Change code to this :

<a href="#sec" id="exploreBtn">Explore</a>
<article id="sec">

CodePudding user response:

you just need to give id to an anchor like for example
<a href="#sec" id="exploreBtn">Explore</a> on pressing this you will go to sec id, which should be declared like this: <article id='sec'>...</a>

  • Related