Μετάβαση στο κύριο περιεχόμενο
Το Frontend είναι ένα δωρεάν μπόνους στο CodeMentor AI — το κύριο προϊόν είναι η Python. Εγγραφείτε για να αποθηκεύσετε την πρόοδό σας και να ξεκλειδώσετε όλα τα 299 μαθήματα Frontend + 1,100+ μαθήματα Python.Εγγραφή — δωρεάν
← 📄 HTML & the platform·Ενότητα A1 · Μάθημα 4
ΕργασίαBuild a page in Ukrainian (lang='uk'). Title 'Привіт', body has an h1 'Привіт, світ' and inside a p with the English phrase 'Hello, world' wrapped in span lang='en'.

χαρακτηριστικό lang: όχι μόνο για προγράμματα ανάγνωσης οθόνης

75 XP6 minFREE
Θεωρία

Four things lang quietly controls

<html lang="en">

This one attribute affects:

  1. Screen reader voice — VoiceOver speaks English differently from German. Without lang, it guesses (and gets it wrong on multilingual pages).
  2. Hyphenation — CSS hyphens: auto uses the language dictionary. Without lang, it can't hyphenate at all.
  3. Spellcheck in inputs — browsers apply the matching dictionary. A French lang="fr" page gets French spellcheck for free in any <textarea>.
  4. Quotation marks — q { quotes: auto } picks "" for English, «» for French, „" for German.

Mixing languages on one page

For a primarily-English page that has a French quote inside:

<html lang="en">
  …
  <p>The motto is <q lang="fr">liberté, égalité, fraternité</q>.</p>
</html>

The lang="fr" on the inner element narrows the scope. Screen readers switch voices for that span.

BCP 47 codes

  • en — English (any variant)
  • en-US — US English specifically
  • zh-Hans — Simplified Chinese
  • pt-BR — Brazilian Portuguese

Use the shortest code that's accurate. CodeMentor itself uses <html lang="uk"> on its Ukrainian-translated pages.

Ζωντανή προεπισκόπηση
← ΠροηγούμενοΕπόμενο μάθημα →

Μια συμβουλή Python ή web την ημέρα — με email

Σύντομο, γραμμένο στο χέρι, χωρίς spam. Διαγραφή με ένα κλικ.