[CSS] HTML 언어별 CSS 적용하는법

개발일기·2022년 7월 23일

:lang() :lang(en) :lang(ch)
다국어로 사이트를 만들때 언어별로 CSS를 다르게 주고 싶을 때 해당 클래스를 사용하여
언어별로 CSS를 설정해준다.

예시 :

      <html lang="en">
      <head>
        <meta charset="UTF-8">
        <title>Lang 셀렉터 예제</title>
        <style>
            p {font-family: "sans-serif", Gulim;}
            p:lang(en) {font-family: "Noto Sans CJK"; font-size:20px;}
        </style>
      </head>

	  <body>
          <p>sample test</p>
      </body>
      </html>

참고사이트 : https://crestia.tistory.com/4
https://developer.mozilla.org/en-US/docs/Web/CSS/:lang

다국어관련 코드 사이트:
https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
https://www.w3schools.com/tags/ref_language_codes.asp

0개의 댓글