Episode 1 — Fundamentals / 1.5 — Semantic HTML and Browser Rendering

1.5.i — Links, Navigation, and Forms

In one sentence: Links should behave like links, navigation should be discoverable and keyboard-friendly, and forms connect user intent to server-side truth — HTML5 validation is a convenience, not a security boundary.

Navigation: ← 1.5.h — Responsive images · ← 1.5 Overview


1. Links: internal vs external

TypeExampleNotes
Internal<a href="/pricing">Prefer root-relative paths on same site
External<a href="https://other.example">Absolute URL
Scheme links<a href="mailto:support@example.com"> · <a href="tel:+15551234567">Opens mail / dialer where supported — still needs visible text, not icon-only

target="_blank": opens a new browsing context — add rel="noopener noreferrer" (modern browsers mitigate window.opener abuse for noopener; noreferrer also strips referrer — know org policy).

download on same-origin links suggests a download instead of navigation — useful for exported files; cross-origin behavior is restricted by browsers.


2. Important rel values

relMeaning (high level)
nofollowHint: do not pass ranking credit (search engines interpret as hint, not command)
sponsoredPaid/partner links
ugcUser-generated content links
noopenerNew tab cannot access window.opener
noreferrerNo Referer header + implies noopener behavior in modern specs discussion — still pair explicitly when in doubt

Use sponsored / ugc honestly — it is trust and policy, not trivia.


3. Forms — structure matters

Healthy form anatomy:

<form action="/subscribe" method="post" novalidate>
  <fieldset>
    <legend>Newsletter</legend>
    <label for="email">Email</label>
    <input id="email" name="email" type="email" autocomplete="email" required />
  </fieldset>
  <button type="submit">Subscribe</button>
</form>
  • label + for/id — bigger click target; accessible name
  • fieldset/legend — groups related controls (especially radio groups)
  • name — what the server receives
  • button type="submit" — explicit default in many designs

method="get" vs method="post": GET appends fields to the URL (bookmarkable, cacheable) — fine for search boxes; POST sends body data — typical for credentials, writes, and large payloads. Sensitive actions still need CSRF tokens and server-side checks (framework-provided patterns).

autocomplete: helps password managers and reduces typos (email, current-password, cc-name, …). Pair with name values platforms recognize.


4. Common input types (HTML5)

typeBuilt-in behavior
emailEmail-shaped validation hint
urlURL pattern hint
numberSteppers; beware — empty vs 0 semantics
telHints mobile keyboards
date / timePickers where supported
searchSearch field semantics
checkbox / radioSelection; radios need shared name

Always pair with labels — placeholders are not substitutes.


5. HTML5 validation attributes (client side)

AttributeRole
requiredMust have a value
minlength / maxlengthString length bounds
min / max / stepNumeric/date constraints
patternRegex constraint

novalidate on <form>: disables browser constraint validation — useful when you fully control UX with JS, but server validation remains mandatory.


6. Client vs server validation

LayerWhat it doesTrust?
HTML5 / JS (client)Fast feedback, fewer round tripsUntrusted — users can bypass
ServerAuthoritative rules, authz, DB invariantsSource of truth

Never rely on client validation for security (price tampering, role changes, SQL safety). Treat the browser as a friendly assistant, not a gatekeeper.


7. Key takeaways

  1. Native <a> + <button> for navigation/actions (1.5.e).
  2. rel communicates intent to platforms (sponsored, ugc) and security (noopener).
  3. Labels + names + server validation are non-negotiable for forms.
  4. HTML validation improves UX — server validates truth.

Explain-It Challenge

Explain without notes:

  1. Why target="_blank" should pair with rel="noopener".
  2. The difference between name on an input and id.
  3. One sentence: why server-side validation is still required when HTML5 required exists.

Navigation: ← 1.5.h — Responsive images · ← 1.5 Overview