The a element
A link is an a element (a stands for anchor). Its href attribute holds the address to go to. The content between the tags, About us, is the text you click. Browsers draw links blue and underlined.
The address in href is a URL (Uniform Resource Locator). https://example.com/menu.html has three parts: the scheme, https, says how to fetch it; the host, example.com, names the computer; the path, /menu.html, names the file there.
Following a link
Click Menu on the page. The browser reads that link's href and puts the URL in the address bar. The old page stays on screen until the new one arrives.
The browser sends a request to the host, example.com: please send me /menu.html. It uses HTTP (HyperText Transfer Protocol), the rules that browsers and web servers share.
The server at example.com answers with the file menu.html, which is HTML too. The browser draws the new page in place of the old one, and the tab shows its title.
Shorter hrefs
Back on index.html, click About us. Its href, about.html, has no scheme or host: it is a relative URL. The browser fills in the missing parts from the current page's URL and loads https://example.com/about.html.
Back on index.html, click Our beans. Its href, #beans, starts with #: a fragment. It points to the element on this page with id="beans". The browser asks no server; it scrolls that heading into view.
Good links
Write link text that says where the link goes. Many people skim links, and screen reader users often jump from link to link. Menu makes sense on its own; click here does not.
What happens
;; step 1/8 · anchor line 3 <a href="about.html">About us</a> <a opening tag: a = anchor href="…" attribute: the address to go to About us content: the text you click </a> closing tag drawn About us blue (#0000EE), underlined
example.com is a name reserved for examples, so it never belongs to a real shop. Its menu.html and about.html pages are imagined here. Before the request, the browser looks up example.com's numeric address (DNS), and with https it sets up encryption first. Other lessons show both. The browser scrolls the heading to the top of the window when the page is long enough. The figure draws a long page; on a page that already fits, nothing needs to move.