0

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

jonasPamm
  • 87
  • 9
  • 1
    Anchor links use the `name` attribute or the `id` attribute, not classes. Multiple elements can have the same class, so that wouldn't work. – isherwood Sep 27 '21 at 16:49

3 Answers3

1

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

<article id="sec">

Pbk1303
  • 3,702
  • 2
  • 32
  • 47
1

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">
Rana
  • 2,500
  • 2
  • 7
  • 28
1

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>