How to declare the language that the HTML document is using

Melissa
2 min readDec 26, 2023

--

Photo by Hannah Wright on Unsplash

In order to declare what language you want to use in your document so that the browser will know what language you are using and how to deal with it, you have to use the tag <html lang=’en’>. Here we declare that our article is in English. This will help the text on your page to be correctly displayed, it will also help the search engine and accessibility tools to understand the content better.

You can use en to declare that you have an HTML document written in English, but there are other languages that you can declare, for example:

This will mean Arabic, so you declare that your document is in Arabic.

This means that your HTML document is in French.

CA means Canadian.

You can use, for example, a combination such as FR-CA, which means Canadian French, or FR-FR, which means French as a spoken language.

The most important thing is not to forget to write lang=’the language you want to declare’

Here is a declaration of real-life code using a language attribute.

<!DOCTYPE html>
<html lang=”en”>
<head>
<title>My bilingual page</title>
</head>
<body>
<p>This paragraph is in English. </p>
<p lang=”fr”> Ce paragraphe est en français. </p>
</body>
</html>

you can follow this link for more informations

HTML lang Attribute (w3schools.com)

--

--