FOLLOW US ON TWITTER



FOLLOW US



img/blogimg/html5.jpg


@coder 1076

HTML Content Languages


2021-11-17 12:48 · 3 min read

HTML Content Languages

It’s a good practice to declare the primary language of the document in the HTML element:

<html lang="en">

 

Base Document Language

If no other lang attribute is specified in the document, it means that everything (i.e., element content and attribute text values) is in that language.
If the document contains parts in other languages, these parts should get their own lang attributes to "overwrite" the language declaration.

 

Element Language

The lang attribute is used to specify the language of element content and attribute text values:

<p lang="en">The content of this element is in English.</p>
<p lang="en" title="The value of this attribute is also in English.">
The content of this element is in English.</p>

The language declaration gets inherited:

<div lang="en">
<p>This element contains English content.</p>
<p title="This attribute, too.">
Same with this element.</p>
</div>

 

Elements with Multiple Languages

You can "overwrite" a language declaration:

<p lang="en">This English sentence contains the
German word <span lang="de">Hallo</span>.</p>

 

Regional URLs

It is possible to add the attribute hreflang to the elements <a> and <area> that create hyperlinks. Such it specifies the language of the linked resource. The language defined must be a valid BCP 47[1] language tag.

 

Handling Attributes with Different Languages

You can "overwrite" a parent element's language declaration by introducing any element apart from an applet, base, basefont, br, frame, frameset, hr, iframe, meta, param, script (of HTML 4.0) with your own lang attribute:

<p lang="en" title="An English paragraph">
<span lang="de" title="A German sentence">Hallo Welt!</span>
</p>

 

 

TAGS:






POST COMMENTS
No Comment

Please login to post comment




POPULAR POSTS

best free web hosting services...
what is new in miui 11?...
free website ssl security using cloudfla...
do you want to make money online?...
CSS3 @IMPORT RULES...
What is HTML Anchor Tag and Hyperlinks?...
CSS3 RESPONSIVE UI...
How to host a web page in 10 minutes....
Tables HTML...
CSS3 FUNCTIONS...
How to use CSS3 Overflow Property?...
CSS3 FILTERS...


RECENT COMMENTS

2022-03-05 11:05
By coder on XAMPP - MySQL shutdown unexpectedly | How to fix MySQL crash unexpectedly
2021-10-12 12:34
By abnongoke on do you want to make money online?
2021-10-12 12:34
By abnongoke on how to get a free website domain name?
2021-10-12 12:34
By solar panel for shed on what is new in miui 11?
2021-10-12 12:34
By solar panel for shed on best free web hosting services
2021-10-12 12:34
By amos tanui on free website ssl security using cloudflare


SOCIAL SHARE



FOLLOW US ON TWITTER



FOLLOW US ON FACEBOOK



FOLLOW US







Recent Blogs



Contact Us

Subscribe Our News-Letter



Kashipur, 244713
Uttarakhand, India



© blog.theprodevelopers.com 2024. All Rights Reserved. Powered by Pro Developer