Why put an ID with a name not referenced anywhere else in html or the css?

I think I understand a little of IDs and Classes but I don’t understand why on the example text for the product landing page, does it have “” but the words nav-bar are no where else in the html (so it doesn’t appear to be an anchor) and nowhere in the CSS (so no Customization). I see “nav” in the CSS but no “nav-bar” so why isn’t the html showing as “nav id=“nav” instead of “nav id=“nav-bar”.
I see this in several web pages where there is an html element with an ID=“some name” but that “somename” doesnt appear any where else in the html or in the CSS, so why use add the ID, why not just use instead of nav id=””?
Thank You for helping me understand this better.

1 Like

the id is a way to uniquely identify the element so that it can be targeted via JavaScript, including, in the case of projects, for the tests to verify that the page satisfy all the requirements

1 Like

Thank You. That makes sense to me. I haven’t learned any javascript yet so I was only looking at it from what I knew about HTML/CSS. I will look forward to seeing what can be done using javascript.
Thanks again.