프로젝트4 - div 섹션 구역 분리 와 CSS 스타일 적용하기

이미지
웹 브라우저에 표시되는 글자와 이미지 들에 디자인 적인 효과( 배경색, 글자색, 크기 조절...) 및 브라우저 내에서의 배치등을 조절하기 위해서는 구역을 나누면 편리해진다. 바로 구역(섹션) 을 나누어 주는 역할을 하는 태그가 div 이다. <div>태그는 브라우저에서 보여지는 시각적 기능은 없다. 단지, 구역을 나누는 역할을 한다.  코드를 만들어 본다. <!DOCTYPE html> <html> <head>   <title>div</title> </head> <body>   <div>     <p>Ice cream is a frozen dessert typically made from milk or cream that has been flavoured with a sweetener,        either sugar or an alternative, and a spice,        such as cocoa or vanilla, or with fruit, such as strawberries or peaches.</p>   </div>   <div>     <p> Food colouring is sometimes added in addition to stabilizers.        mixture is cooled below the freezing point of water and stirred to incorporate air spaces and prevent detectable ice crystals from forming.        It can also be made by whisking a flavoured cream base and liquid nitrogen together.        The result is a smooth, semi-solid foam that is solid at v

구글 폰트 적용하기

구글 폰트를 적용하는 방법이다.

1. 구글폰트 사이트에 접속한다.

https://fonts.google.com/


접속하면 여러가지 폰트들이 있다.
하나의 폰트를 선택하고 다운로드 혹은 웹에서 사용할 수 있는 웹폰트를 적용해본다.

2. 폰트 적용하기(폰트 확인하ㄱ


예시로, Language 애서 한국어 를 선택하고 리스트된 폰트 중 하나를 선택한다.
해당폰트의 Glyphs 탭에서는 지원언어를 확인할 수 있고, 언어별 폰트 미리보기가 가능하다.


Type tester 탭에서는 폰트를 미리 타이핑 해볼 수 있다.


3. 폰트 다운로드

Get font 버튼 클릭!


여기서는 폰트가 설치되어있지 않아도 폰트를 적용할 수 있는 웹폰트 방식으로 
설치를 해본다. 즉, 유저의 PC에 해당 폰트가 없어도 링크방식으로 해당 폰트를 사용할 수 있다. 
<>Get embeded code 를 선택한다.

브라우저 웹폰트를 적용하기 위해서
Web 탭에 link, @import 둘중 하나를 선택한다. 여기서는 link 로 진행한다.

4. 웹 폰트 적용하기

- link 요소는 head 태그 사이에 붙여넣고, CSS 스타일은 <style>태그를 만들어서 붙여넣는다. 여기서 스타일시트는 내부스타일시트 방식을 사용했다. 상황에 따라 외부스타일시트 방식을 사용할 수도 있다.
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width,
initial-scale=1.0">
  <title>web font</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=
Single+Day&display=swap" rel="stylesheet">
  <style>
    .single-day-regular {
      font-family: "Single Day", cursive;
      font-weight: 400;
      font-style: normal;
    }
  </style>  
</head>
<body>
  <p class="single-day-regular ">Lorem Ipsum is simply dummy text
of the printing and typesetting industry. Lorem Ipsum has been
the industry's standard dummy
  text ever since the 1500s, when an unknown printer took a
galley of type and scrambled it to make a type specimen book.
It has survived not only five centuries, but also the leap
into electronic typesetting,remaining essentially unchanged.
It was popularised in the 1960s with the release of Letraset
sheets containing Lorem Ipsum passages, and more recently with
desktop publishing software like Aldus PageMaker including
versions of Lorem Ipsum</p>  
</body>
</html>

브라우저에 적용된 결과는 하기와 같다.
구글폰트를 사용하면 웹 폰트 및 다운로드 및 모바일 앱 어플리케이션 폰트역시
손쉽게 적용이 가능하다.

댓글

이 블로그의 인기 게시물

구글 블로그 이미지 복사 붙여넣기 가능한가요?

HTML 페이지 기본 구성.(HTML Page Structure)

구글 블로그 대표이미지 설정하기