프론트엔드/CSS

CSS 24 box content의 크기 설정

스펀지연구소 2021. 4. 3. 21:11


<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
  p{
    background-color: yellow; 
    color: red;
    font-weight: bold; 
    font-size: 16pt;
    }
    p.c1{
      width: 700px; 
      height: 80px; 
      color: green;
      }
      p.c2{
        width: 50%; 
        height: 150%; 
        color: purple;
        }
        p.c3{
          width: 10cm; 
          height: 3cm; 
          color: blue;
          }
          </style>
</head>
<body>
  <p>박스모델의 내용영역 크기 지정</p>
  <p class="c1">(1) 박스모델의 크기를 픽셀(px) 단위로 지정</p>
  <p class="c2">(2) 박스모델의 크기를 퍼센트(%) 단위로 지정</p>
  <p class="c3">(3) 박스모델의 크기를 센티미터(cm) 단위로 지정</p>
</body>
</html>