HTML Tutorial

HTML Links

The a tag is the web: internal pages, other sites, email, and jump links on the same page.

The a element

A link is an <a> element. The visible text (or image) goes between the start and end tags. The destination is the href attribute: hypertext reference. Without href, you have a placeholder, not a link.

Example

<p>Read the <a href="/html/intro">HTML introduction</a> first.</p>
<p>
  StudyGrid lives at
  <a href="https://www.studygrid.app" title="StudyGrid home page">studygrid.app</a>.
</p>

Relative paths such as /html/intro stay on the same site. Absolute URLs start withhttps:// and point anywhere on the web.

href destinations

href can name a page, a file, an email address, or a spot on the current page. The browser decides what to do from the value, not from the link text.

hrefOpens
/html/imagesAnother page on this site
https://example.comAnother site
mailto:hello@example.comThe visitor’s mail app
#scoresThe element with id="scores"

Write link text that still makes sense out of context. “HTML Images” is better than “click here.” Screen readers and search results often list links without the surrounding paragraph.

Open a new tab with care

target="_blank" opens the URL in a new browsing context, usually a tab. Pair it withrel="noopener" so the new page cannot touch window.opener on your page. That pairing is the default habit for off-site links you send to a new tab.

Example

<p>
  Specification:
  <a href="https://html.spec.whatwg.org/" target="_blank" rel="noopener">
    HTML Living Standard
  </a>
</p>
<p>Same-site chapters can stay in this tab. New tabs are for leaving the tutorial.</p>

Do not force a new tab for every link. People who want a new tab can do that themselves. Use_blank when leaving would lose work, such as a form in progress.

Email with mailto:

A mailto: href opens the default mail client with the address filled in. You can add a subject with a query string. Not every device has a mail app configured, so keep a visible address in the text as well when the contact path matters.

Example

<p>
  Write to
  <a href="mailto:hello@example.com">hello@example.com</a>
  or use a subject line:
  <a href="mailto:hello@example.com?subject=HTML%20tutorial">Ask about the HTML tutorial</a>.
</p>

Jump links with #id

Give a target an id. Link to it with href="#that-id". The page scrolls to the element. Ids must be unique on the page. Use letters, digits, hyphens, and underscores; start with a letter.

Example

<nav>
  <a href="#overview">Overview</a>
  <a href="#scores">Scores</a>
</nav>

<h2 id="overview">Overview</h2>
<p>Jump links skip the visitor to a heading on this same page.</p>

<h2 id="scores">Scores</h2>
<p>This heading is the target of href="#scores".</p>

In the live preview at /html/try, click the jump links to see the scroll. On a long tutorial page, the same idea powers “skip to content” and table-of-contents links.

The title attribute

title is extra hint text. Many browsers show it as a tooltip on hover. The first example on this page puts a title on the StudyGrid home link. Do not put essential information only intitle: keyboards, phones, and screen readers may never see it. Use it for a short extra, such as the full name of an abbreviation you already expanded in the text.

Prefer clear link text over a long title. If the tooltip is doing all the work, rewrite the words inside the <a> instead. The live preview at /html/try is the place to hover a link and confirm the hint.

Worked examples

The short listings above show the tag in isolation. These pages use the same markup on documents you would actually publish: a lab report, a clinic form, a timetable, a weather card.

HTML does not calculate. It names the pieces so a browser, a screen reader, and a search engine can tell a heading from a paragraph. The numbers below are classroom values — the same Ohm, pH, and pulse figures as the C track — now sitting in real page structure.

Preview them in the HTML editor at /html/try. Change a heading or a number and watch the page, not a print log.

Biology

Email the clinic, jump to hours

a with href is the web. A path like /html/intro is internal. mailto: opens mail. #hours jumps to id="hours" on this page.

target="_blank" needs rel="noopener" so the new tab cannot touch this one. Use it for other sites, not for every internal chapter.

Example

<nav>
  <a href="#hours">Hours</a>
  <a href="mailto:clinic@example.com">Email the clinic</a>
</nav>
<h2 id="hours">Hours</h2>
<p>Walk-in 08:00–16:00</p>

Astronomy

A skip link into the article

Skip links are the first focusable control for keyboard users. href="#main" and id="main" on the content is the pair. Without the id, the link goes nowhere.

Example

<a href="#main">Skip to Mars notes</a>
<main id="main">
  <h1>Mars</h1>
  <p>Year ≈ 687 Earth days.</p>
</main>

FAQ: HTML Links

Common questions about this page.

What is the StudyGrid HTML tutorial?

The StudyGrid HTML tutorial is a full beginner track: tags, headings, links, images, tables, layout, forms, and media. Each chapter has copy-and-run examples.

Should I run html links examples locally for better learning?

Yes. Use the browser editor on StudyGrid for a quick check, then Download the example and run it on your computer. Local runs show real errors and the real toolchain, which is one of the fastest ways to learn html links in this HTML HTML lesson (HTML Links).

Is the HTML editor the same as Try Python?

No. Try HTML is a live page preview at /html/try. Try Python stays at /try and runs Python. HTML lessons never open the Python editor.

Do I need to install anything to learn HTML?

No. Open a chapter, click Try it in HTML, and the page preview updates in the browser. You can also download a .html file and open it locally.

Where should I start the HTML tutorial?

Start at HTML Intro, then Basic, Elements, and Attributes. After the first document, continue to headings, links, and forms. Use Next at the bottom of each chapter.

Is the HTML tutorial free?

Yes. The HTML studio on StudyGrid (studygrid.in) is free: dashboard, chapters, and the live preview editor.