Computer >> Computer tutorials >  >> Programming >> CSS

Usage of :lang pseudo-class in CSS


Use the :lang pseudo class to specify a language to use in a specified element. This class is useful in documents that must appeal to multiple languages that have different conventions for certain language constructs.

Example

You can try to run the following code to understand the usage of :lang pseudo class

<html>
   <head>
      <style>
         /* Two levels of quotes for two languages*/
         :lang(en) { quotes: '"' '"' "'" "'"; }
         :lang(fr) { quotes: "<<" ">>" "<" ">"; }
      </style>
   </head>
   <body>
      <p>...<q lang="fr">A quote in a paragraph</q>...</p>
   </body>
</html>