December 3, 2026 - 08:49
HTML Lesson 08 — Connect Pages with a and href Image
HTML & CSS Tutorials

HTML Lesson 08 — Connect Pages with a and href

0 Comments

Links let us leave a page for another source, visit an About page, or jump to a section further down the same document. All three use a; what changes is how we describe the destination.

A destination and a label

HTML
<h1>Not Defteri</h1>
<p><a href="hakkimda.html">Hakkımda</a></p>
<p><a href="https://developer.mozilla.org/">MDN web belgeleri</a></p>
<p><a href="#kitaplar">Kitap notlarına git</a></p>
<h2 id="kitaplar">Kitap notları</h2>
<p>Okuma listem burada yer alacak.</p>

href tells the browser where to go. The content between the tags supplies the visible label. The first link looks for hakkimda.html in the same folder as the current file. A blue, underlined label does not guarantee that the target file exists.

Keep the two example files together. The About page includes a link back to index.html, so you can test both directions. Renaming a file also requires updating links that refer to its old name.

External addresses and section targets

https://developer.mozilla.org/ is a complete web address. The browser visits that site rather than searching your local folder.

#kitaplar refers to an element with id="kitaplar" in the current document. The visible heading can contain different wording. The fragment matches the identifier, not the heading's text. Each identifier must be unique within its document.

If the heading is already visible, the movement may be tiny. Add a few paragraphs above it to make the jump easier to observe. Also check the address: it should end with #kitaplar. A target in another page can be written as hakkimda.html#iletisim, provided that page contains the matching identifier.

Read the parts of an address

TEXT
https://example.com/notlar.html?konu=html#baslangic

This illustrates URL syntax, not an existing example.com resource. Https is the scheme, example.com the host, /notlar.html the path, the question-mark section a query and the hash section a fragment.

Href can contain that whole address. A question mark does not write a JavaScript condition here. A fragment commonly targets an element identifier. Repeated heading text is possible, but duplicate IDs in one document are not a valid way to create independent targets.

Placeholder links still navigate

An empty href resolves as an empty reference to the current document, while # supplies an empty fragment. These are not neutral substitutes for action buttons. They can cause navigation or scrolling. Use a button for an action that does not represent going to another location.

An a element without href does not automatically acquire the normal behavior of a real hyperlink. Blue styling cannot replace the right semantics or keyboard behavior.

Test without a mouse

Use Tab to focus the page's links and Enter to follow them. Preserve a visible focus indication when we later add CSS. Users need to see which control will respond.

Read link labels alone. A destination name is more informative than repeated “here” labels when links are encountered outside their surrounding sentences. This does not require long labels; it requires useful ones.

Other schemes request other applications

HTML
<a href="mailto:ornek@example.com">Write an email</a>
<a href="tel:+902120000000">Call by phone</a>

Mailto can request an email application and tel can request a calling application. The result depends on the device, installed handlers and user choices. A link alone is not proof of a sent email or completed call.

Test an internal page, an external address and a section target using the keyboard. After moving a local file, verify both the outgoing link and the route back rather than treating one successful click as proof of all paths.

Should every link open a new tab?

The default is to navigate in the current tab. When a new browsing context is appropriate, use:

HTML
<a href="https://developer.mozilla.org/" target="_blank" rel="noopener">MDN belgeleri (yeni sekme)</a>

target="_blank" requests a new browsing context, usually a new tab. rel="noopener" prevents the opened page from accessing the opener through window.opener. Current browsers generally apply this protection implicitly to this target, but the example makes it explicit.

Opening every internal link in a new tab can leave readers with an unnecessary collection of tabs. Keep the default when there is no reason to change it. Prefer descriptive text such as “About me” or “MDN web documentation” over an isolated “Click here.”

For your last test, rename the About file without updating the link. Observe the broken target, then fix href. Writing a link and supplying a real destination are separate requirements.

References: MDN

Related Articles

Comments (0)

No comments yet. Be the first to comment!

Leave a Comment