Help ! Same page 15/17

Hi everyone;

For this exercice i did the first question successfully
But I didn’t understand the second one;
2.
Wrap the text of each list item in the unordered list in an anchor element. Each anchor tag should link to the corresponding <div>on the page (The <a> element that contains the text “Introduction” links to #introduction).

Someone can help me, pleaseeeee :slight_smile:

this instructions consist of two parts:

Do you understand this? <li></li> is the list item, each list item has text, which should be wrapped in an anchor element (<a></a>)

anchor elements allow us to make hyperlink reference to different pages, or in this case, different div elements on the same page using the ids. So the list item that says introduction, should have a hyperlink reference (href attribute) pointing to #introduction. Which reference to <div id="introduction">, so that when text in anchor element is clicked, the page jumps to the div with id introduction

1 Like

The mistake I did not realize I was making is that the id inside the first half of the anchor has to all lower case but the id at the end of the anchor has to be capitalized. So, a href="#introduction">Introduction

2 Likes

I made the same mistake. Thanks for the help!!

I just want to clarify what is happening here. Neither #introduction nor Introduction are ids.

href="#introduction" is an HTML attribute. href stands for hypertext reference and the value provided in between the quotation marks can be an absolute (e.g. https://codecademy.com/catalog/all) or relative path (e.g. /catalog/all), or refer to a section on the same page (#id). Here, #introduction will lead you to the element with the id value "introduction" on the same page. Hence, href="#introduction" is not an id, but rather indicates the id of the element on the same page to which you want to jump to.

Introduction is not an id either. It is simply the word(s) you want to be displayed as text for the link.

More on anchor (<a>) elements here.