Style HTML elements based on locale using the CSS :lang pseudo class

html

Using the :lang pseudo class selector, you can style an element based on a clients locale.

The snippet below will color the text inside of any span tag with the lang attribute ca

span:lang(ca) {
  color: #eee;
}
<!doctype html>
<html lang="ca">
<head></head>
<body>
  <span>No n'hi ha prou amb una llengua</span>
</body>
</html>

more HTML posts

more CSS posts