In this video, you linked the garden’s home page and its new plots page to each other, to a section by its id, and to Rosa’s email.
Key Points
- A link is an
<a>element, short for anchor. The words between its tags are the link text, which the browser shows underlined by default. It’s blue until you’ve visited the link, and purple after. - The
hrefattribute says where clicking the link goes: plots.html: a file name on its own means a file in the same folder as the current page.#seed-swap: a hash sign and anidpoint at that element on the current page. The address gains#seed-swap, and on a page longer than the window, the browser scrolls that element into view.index.html#work-day: a file name, then a hash sign and anid. The browser loads the file, then finds the element with thatid.mailto:[email protected]: the browser hands the address to whatever handles email on the visitor’s system. That’s often a mail app or webmail with a new message to Rosa. With nothing set up, the visitor might get a chooser, or nothing at all. The address itself is the link text, so every visitor can still read it. Atel:link works the same way for a phone number, and a phone offers to call.- Make link text name where the link goes. Screen reader users often jump from link to link, or list them all, and hear each link without its sentence. A page full of “click here” links tells them nothing.
- You may also see
target="_blank"on a link. It opens the link in a new tab or window. Use it sparingly, and leave it off between your own pages, since visitors can already open any link in a new tab themselves when they want one.
Final Code
Your home page and plots page now link to each other. Here’s index.html, the home page, with its link to the plots page, its jump to the seed swap section, and Rosa’s address as a mailto: link: