• 카테고리

    질문 & 답변
  • 세부 분야

    풀스택

  • 해결 여부

    미해결

footer가 상품카드 쪽을 침범해서 문의드립니다..ㅜ

21.12.11 20:01 작성 조회수 487

1

/*html*/
 
<html>
  <head>
    <title>그랩마켓</title>
    <link href="index.css" type="text/css" rel="stylesheet" />
  </head>
  <body>
    <div id="header">
      <div id="header-area">
        <img
          src="C:\Users\82104\Desktop\learn javascript\grab-market\images\icons\logo.png"
        />
      </div>
    </div>
    <div id="body">
      <div id="banner">
        <img
          src="C:\Users\82104\Desktop\learn javascript\grab-market\images\banners\banner1.png"
        />
      </div>
      <h1>판매되는 상품들</h1>
      <div id="product-list">
        <div class="product-card"></div>
        <div class="product-card"></div>
        <div class="product-card"></div>
        <div class="product-card"></div>
        <div class="product-card"></div>
        <div class="product-card"></div>
      </div>
    </div>
    <div id="footer"></div>
  </body>
</html>
 
 
 
/*css*/
 
* {
  margin: 0;
  padding: 0;
}

#header {
  height: 64px;
  display: flex;
  justify-content: center;
  border-bottom: 1px solid;
}

#body {
  height: 100%;
  width: 1024px;
  margin: 0 auto;
}

#footer {
  height: 200px;
  background-color: red;
}

#banner {
  height: 300px;
  background-color: yellow;
}

#header-area {
  width: 1024px;
  height: 100%;
  display: flex;
  align-items: center;
}

#header-area > img {
  width: 128px;
  height: 36px;
}

#banner > img {
  width: 100%;
  height: 300px;
}

#body > h1 {
  margin-top: 16px;
}

.product-card {
  width: 180px;

  height: 300px;

  background-color: gray;
}
 
 
 

답변 2

·

답변을 작성해보세요.

1

gooslbi님의 프로필

gooslbi

질문자

2021.12.11

이렇게 작성했는데 footer의 빨간 부분이 상품 카드 위쪽을 가리고 있었습니다..

혹시 몰라서 재작성도 해 봤는데 그대로여서 답변 부탁드려요.!

0

현재 product-card들이 #body의 height인 100%를 넘어버리기에 생기는 문제입니다! 

강의 뒷부분에서 수정하는 부분이 나오는데, height: 100%를 min-height: 100%로 적용해주면 됩니다.