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

전체 1,264
퍼블리셔팁 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT