IT/css

css 백분율과 em의 조합 사용

조원태 2017. 2. 20. 22:42
반응형

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





반응형

'IT > css' 카테고리의 다른 글

CSS Links Text Decoration  (0) 2017.02.25
CSS Links 배경색  (0) 2017.02.25
css Em로 글꼴 크기 설정 Set Font Size With Em  (0) 2017.02.20
css Font Size 글자 크기  (0) 2017.02.20
css Font Style 글꼴 스타일  (0) 2017.02.19