Anchor tags have two opposite purposes
<a href=''>
- to link out to another location <a name=''>
- to name a location inside a page that can be linked into
inner anchors are also defined by id
in modern browsers
when linking to an inner anchor, use the # character to distinguish files from inner anchors)
<a href='#stuff'>here is my stuff</a>
<a href='#things'>here are my things</a>
...
<a name='stuff'>
<h2>My Stuff</h2>
...
<h2 id='things'>My Things</h2>
#someId
selectorhref="/somePage.html"
href="https://www.example.com"
<a href="#about-me">About Me</a>
Anchor tags are probably the most useful element to use when setting up site navigation. Let's make a page with some basic navigation capabilities.
cd
into the example-html
directory we set up in the "Hello, HTML!" labindex.html
which has a header, and at least three seperate sectionsabout.html
, and put an h1 element with the text "About Page" (or something similar) in itIf you are building this off of your 'Hello, HTML!' lab your index.html
will already have several sections set up
In your index.html
document create a nav section that links to at least two internal sections, the about page, and at least one external site of your choice.
/