본문 바로가기

css

12장 예제- 그리드 박스에서 칼럼과 줄 지정하기

<!DOCTYPE html>
<html lang="ko">
<head>
  <meta charset="UTF-8">
  <title>그리드 박스에서 칼럼과 줄 지정하기</title>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <style>
   
   #wrapper {
    display:grid; /*그리드 컨테이너 지정*/
    grid-template-columns: 200px 200px 200px; /*너비가 200px인 칼럼 3개 */
    grid-template-rows : 100px; /*줄 높이 100px*/
   }

   .items {
    padding:10px;
    background-color:#eee;
   }
 
   .items:nth-child(odd) {
    background-color:#bbb;
   }
  </style>
</head>
<body>
  <div id="wrapper">
    <div class="items">Lorem ipsum dolor sit amet consectetur adipisicing elit. Amet, reprehenderit.Lorem ipsum dolor, sit amet consectetur adipisicing elit. </div>
      <div class="items">Lorem ipsum dolor, sit amet consectetur adipisicing elit.Lorem ipsum dolor, sit amet consectetur adipisicing elit</div>
      <div class="items">Lorem ipsum dolor sit amet.Lorem ipsum dolor, sit amet consectetur adipisicing elit</div>
      <div class="items">Lorem ipsum dolor sit.Lorem ipsum dolor, sit amet consectetur adipisicing elit</div>
      <div class="items">Lorem, ipsum dolor.
    </div>
  </div>
 
</body>
</html>