본문 바로가기

Coding

[FONT] 구글 웹 폰트 적용

HTML 상에서 폰트 적용을 해야하는 경우 아래 링크로 접속한다.

 

URL : https://fonts.google.com/?subset=korean 

 

Google Fonts

Making the web more beautiful, fast, and open through great typography

fonts.google.com

 

접속 후 원하는 폰트를 클릭하며 아래 화면이 나오면 + 'Select this style' 클릭

페이지 오른쪽에 팝업창 발생하며 빨간색 박스 안 <link href ~~>는 <head> 내에 <title> 하단부에 넣어준다.

아래 파란색 박스 안에 있는 font-family는 <style> 안에 *{ } 에 넣어준다.

<head>
<meta charset="UTF-8">
     <meta name="viewport" content="width=device-width, initial-scale=1.0">
     <title>스파르타코딩클럽 | 로그인페이지</title>
     <link rel="preconnect" href="https://fonts.googleapis.com">
     <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
     <link href="https://fonts.googleapis.com/css2?family=Black+Han+Sans&display=swap" rel="stylesheet"
>

 

// 빨간색 글씨가 HTML 상에서 적용할 태그이다.

 

     <style>
          * {
          font-family: 'Black Han Sans', sans-serif;
          }

     </style>

 

// 파란색 글씨는 폰트를 적용하겠다는 태그이며, ' * ' 를 사용할 경우 모든 HTML PAGE에 적용된다.