HTML・First steps

Links to other pages

Click it, and you jump to another page — links are the very mechanism that makes the Web a "web." You make them with the a tag.

The Web’s greatest magic is that clicking on text takes you to another page. Because of this “connection,” pages all over the world are linked together like a spider’s web. What makes it happen is the link, and the tag you use is <a>.

<a href="https://example.com">View the sample site</a>

Break it down and it looks like this.

PartMeaning
<a>Short for “anchor.” The tag that makes a link
href="..."The destination address (URL). This is the crucial part
View the sample siteThe clickable text shown on screen

It means “when you click the text View the sample site, you jump to the place in href.” On screen, just that text changes color — the signal that it’s clickable.

The surrounding text stays black, and only the linked text turns blue with an underline. That’s the “clickable” signal. Hover your mouse over it and the cursor turns into a pointing finger; click it and the destination opens in a new tab — go ahead and try it.

Jumping to a page within your site

You can jump not only to outside sites but also to another page of your own site. In that case, you write the path to that page’s file.

<a href="/about.html">About this site</a>

If a long address starting with https://... is like “the address of a house outside,” then /about.html is like “a room number inside the same house.” Within the same site, you can write it short.

On top of that, you can also make it jump to a specific spot within the same page. The “table of contents” links on a long page are exactly that.

HTMLIn-page linksWe’ll cover how to make links that jump within a page in detail in the next lesson

Actually, there’s a knack to choosing the text you turn into a link: make it so the link text alone tells you “where it goes.”

<!-- △ Close, but not quite: you can't tell where it goes -->
<p>For details, click <a href="/menu.html">here</a>.</p>

<!-- ○ Good example: the text alone tells you the destination -->
<p>For details, go to the <a href="/menu.html">menu page</a>.</p>

If you turn only “here” or “this” into a link, people who skim through the links, or who listen with screen-reader software, won’t know where it goes. Turn the destination’s own name into the link — that alone makes for a far kinder page.

Compare just the link text. With “here” you can’t tell the destination without reading around it, but “menu page” tells you where it goes from the text alone.

A link’s destination isn’t limited to web pages. By changing how you write href, you can make links that open a new email or place a phone call.

<a href="mailto:[email protected]">Send an email</a>
<a href="tel:09000000000">Make a call</a>
How to write itWhen you tap it…
href="mailto:email address"A screen for writing an email opens
href="tel:phone number"You can place a phone call on a smartphone

Handy when you want to place a shop’s contact info, or your own “contact me” info.

They look just like an ordinary link, blue with an underline. Tap them, and instead of a web page, a new email or a phone call screen opens — go ahead and tap.

Summary of this lesson

  1. A link is <a href="destination">text</a>
  2. Write the destination (URL) in href
  3. You can jump to outside sites, and to other pages within the same site

Let’s add “Contact” to Shima’s page. Below an <h2>, line up links to YouTube and email with <a>.

<h2>Contact</h2>
<a href="https://www.youtube.com/">YouTube</a>
<a href="mailto:[email protected]">Email</a>

mailto: is a link that opens a new email when tapped. https://... jumps to that web page.

Browser view. Under the “Contact” heading, the YouTube and email links are lined up in blue, underlined text
Only the linked text turns blue — the signal that it’s clickable.

Once it works, try rewriting it with your own links. A site you visit often, or your own email address, is perfectly fine.

FAQ

How do I open a link in a new tab?
Add target="_blank" to the a tag. Adding rel="noopener" alongside it makes it a safer form where the page you open can't manipulate the original page.
Can I change the blue color and underline of a link?
Yes. In CSS, set color or text-decoration:none (to remove the underline) on the a tag. Just be sure to keep some visual cue that says "this is clickable."
What's the difference between an href that starts with "/" and one that's just a file name?
A path starting with "/" is an address counted from the very top level of the site; a path with just a file name is an address counted from the same folder as the current page.