컴

백분율과 em의 조합 사용

백분율과 em의 조합 사용

 

모든 브라우저에서 작동하는 솔루션은 <body> 요소의 기본 글꼴 크기를 백분율로 설정하는 것입니다.

 

 

body {

    font-size: 100%;

}

 

h1 {

    font-size: 2.5em;

}

 

h2 {

    font-size: 1.875em;

}

 

p {

    font-size: 0.875em;

}

 

 

 

<!DOCTYPE html>

<html>

<head>

<style>

body {

    font-size: 100%;

}

 

h1 {

    font-size: 2.5em;

}

 

h2 {

    font-size: 1.875em;

}

 

p {

    font-size: 0.875em;

}

</style>

</head>

<body>

 

<h1>This is heading 1</h1>

<h2>This is heading 2</h2>

<p>This is a paragraph.</p>

<p>Specifying the font-size in percent and em displays the same size in all major browsers, and allows all browsers to resize the text!</p>

 

</body>

</html>

d209a7ffd7e5836c3bf7a103bf510cc9_1487598113_4768.png

댓글 1개

좋은거 알려주셔서 감사합니당ㅎㅎ
댓글을 작성하시려면 로그인이 필요합니다.

퍼블리셔팁

1,282건

퍼블리싱과 관련된 유용한 정보를 공유하세요. 질문은 상단의 QA에서 해주시기 바랍니다.

+
분류 제목 글쓴이 날짜 조회
CSS 17-03-13 조회 2,905
CSS 17-03-13 조회 2,779
CSS 17-03-11 조회 2,245
CSS 17-03-11 조회 2,269
CSS 17-03-11 조회 2,514
CSS 17-03-09 조회 1,931
CSS 17-03-09 조회 2,573
CSS 17-03-09 조회 2,117
CSS 17-03-08 조회 2,550
CSS 17-03-08 조회 2,609
CSS 17-03-08 조회 2,600
CSS 17-02-28 조회 2,407
CSS 17-02-28 조회 2,144
CSS 17-02-28 조회 2,630
CSS 17-02-27 조회 1,950
CSS 17-02-27 조회 2,051
CSS 17-02-27 조회 2,157
CSS 17-02-26 조회 2,772
CSS 17-02-26 조회 2,840
CSS 17-02-26 조회 2,223
CSS 17-02-25 조회 2,680
CSS 17-02-25 조회 2,251
CSS 17-02-25 조회 2,288
CSS 17-02-24 조회 2,191
CSS 17-02-24 조회 1,906
CSS 17-02-24 조회 1,960
CSS 17-02-21 조회 3,482
CSS 17-02-21 조회 2,476
CSS 17-02-21 조회 2,076
CSS 17-02-20 조회 2,514