DIY website updates · HTML language

Set the Page Language on a Static Business Website

Tell browsers and assistive technology which language your page actually uses. A small HTML change belongs in a careful review of the page and its shared templates.

Use a valid lang attribute on the opening html element to declare the main language of the page. Choose the language of the written content, then check the deployed HTML. The attribute does not translate your website.

Choose the language of the actual text

Start by reading the main content, navigation, form labels, and next action. An English-language business page can declare en; a Spanish-language page can declare es. A business address in Texas does not decide the document language. The words visitors read do.

Do not change an English page to Spanish merely because you want Spanish-speaking customers. Visitors still need usable Spanish content and an ordering or inquiry path they can understand. A language declaration is one technical detail within that larger content decision.

MDN explains that the HTML lang attribute helps identify an element's language, including for screen-reader pronunciation. It expects a valid language tag. Do not invent a value such as english. Use a recognized tag and add a regional subtag only when it accurately describes the content.

Set the default on the HTML element

Open the HTML file that produces the public page. Near its beginning, find the opening html tag. For an English page, the basic document structure can look like this:

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>Your page title</title>
</head>
<body>
  <!-- Your existing page content stays here. -->
</body>
</html>

This shows placement, not a replacement website. Edit the existing opening tag and retain the rest of its attributes and page content. Do not paste a second HTML document into the page body. If a language value is already correct, leave it in place.

W3C's language declaration guidance explains why the default belongs on the HTML element. A title, character encoding declaration, or translated browser interface does not replace that declaration.

Mark a passage in another language

A short passage can have a different language from its surrounding page. Add the appropriate lang attribute to the element containing that passage, rather than changing the whole document to match a few words:

<html lang="en">
  ...
  <p lang="es">Envíenos los detalles de su proyecto.</p>
  ...

The Spanish sentence above is an illustrative request to send project details. Use your actual reviewed wording. Keep the language attribute close to the passage it describes. A separate, fully translated page should have its own appropriate default language; this example does not create a translation system or a language-switching menu.

Check shared templates and generated pages

Some static websites contain one hand-edited HTML file per page. Others produce files from a shared template. Identify which file is the source before editing. Changing only a generated file may be overwritten the next time the generator runs.

Ask an AI coding assistant to locate the opening HTML element, explain whether it comes from a shared layout, and propose the smallest change. Review the diff for unrelated edits to navigation, scripts, styles, forms, and checkout. The AI website change review guide covers that review process.

If you maintain several pages, check a representative service page, resource, contact page, and any translated page. A shared English template can be correct for most pages and still wrong for a separately written Spanish page.

Verify preview and production

Open the preview and inspect the opening HTML element using browser developer tools. Confirm that there is one document element and that its language value matches the intended content. View the page source too, especially if scripts or a generator may change the initial markup.

Read the visible page after the change. Navigation, form labels, and next actions should still be intact. Check a narrow phone layout as well as desktop. A language attribute alone should not be used as a reason to redesign the page.

After the normal deployment succeeds, open the exact public URL and inspect its HTML again. A correct local file does not establish that production received the update. Use the developer-tools troubleshooting guide if you need help locating page markup.

Where possible, include an assistive-technology check with the appropriate language voice available. A missing voice or an unexpected pronunciation needs investigation; an automated pass or a single listening check does not establish that the entire website is accessible.

Planning a full second-language version? The bilingual business website planning checklist covers translated page pairs, inquiry paths, approvals and ongoing updates.

Keep content and language markup aligned

Record the intended language with the page's source or content instructions. Recheck the declaration when a page is translated, replaced, copied from a template, or generated through a new publishing workflow. Review longer passages in a different language as part of that update.

For the broader navigation, headings, forms, and image review, use the business website accessibility checklist. For the complete DIY site workflow, explore the BUILD • PUBLISH • OWN IT guide. If someone else will handle ongoing technical updates, review website management.

Need help reviewing a website update?

Send the page URL, the language its content uses, and whether the change belongs to one page or a shared template. We can review the scope with you.