백분율과 em의 조합 사용 > 퍼블리셔팁

퍼블리셔팁

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

백분율과 em의 조합 사용 정보

CSS 백분율과 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개

© SIRSOFT
현재 페이지 제일 처음으로