CSS3 > Selectors

Language selector in CSS3

How to select the elements with a lang attribute in CSS3?


By using lang selector we can select the elements with a lang attribute. The lang attribute value is mostly a two-letter language code like ('fr' for french, 'ar' for arab, etc...).

<style>
        div:lang(bn) {
            color: blue;
            background-color: pink;
        }
</style>

<body>
    <p>Welcome to Bengal</p>
    <div lang="bn">Banlaya sbagatama</div>
    <p>"Banlaya sbagatama" means 'welcome to Bengal' in Bengali language.</p>
</body>

In the above code snippet in lang selector is used to present the text "Welcome to Bengal" on webpage in Bengali language.

OUTPUT

 Views: 643 | Post Order: 26



Write for us