강의

멘토링

커뮤니티

인프런 커뮤니티 질문&답변

yami654님의 프로필 이미지
yami654

작성한 질문수

비전공자를 위한 진짜 입문 올인원 개발 부트캠프

[그랩마켓] 웹 화면 구현하기 - 3

span태그 줄바꿈 하려고 flex적용시켰지만 안됩니다.

작성

·

1K

1

span태그 줄바꿈 하려고 flex적용시켰지만 안됩니다.
전에 한번했을때는 됐었는데 이번에는 왜 안되는걸까요??
<html>
  <head>
    <title>그랩마켓</title>
    <link href="index.css" type="text/css" rel="stylesheet" />
  </head>
  <body>
    <div id="header">
      <div id="header-area">
        <img src="images/icons/logo.png" />
      </div>
    </div>
    <div id="body">
      <div id="banner">
        <img src="images/banners/banner1.png" />
      </div>
      <h1>판매되는 상품들</h1>
      <div id="product-list">
        <div class="product-card">
          <div>
            <img class="product-img" src="images/products/basketball1.jpeg" />
          </div>
          <div class="product-contents"></div>
          <span>농구공 1호</span>
          <span>50000원</span>
        </div>
      </div>
    </div>
    <div id="footer"></div>
  </body>
</html>
* {
  margin: 0;
  padding: 0;
}

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

#body {
  height: 100%;
  width: 1024px;
  margin: 0 auto;
  padding-bottom: 24px;
}

#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: 16px;
}

#product-list {
  display: flex;
  flex-wrap: wrap;
  margin-top: 12px;
}

.product-card {
  width: 180px;
  height: 300px;
  background-color: gray;
  margin-right: 12px;
  margin-bottom: 12px;
  border: 1px solid rgb(230, 230, 230);
  border-radius: 12px;
}

.product-img {
  width: 100%;
  height: 200px;
}

.product-contents {
  display: flex;
  flex-direction: column;
  padding: 8px;
}

답변 1

0

그랩님의 프로필 이미지
그랩
지식공유자

<div class="product-contents"></div>

<span> ... 

위와 같이 코드가 되어 있는데요. product-contents의 flex를 적용하려면 span태그를 저 div 태그 안으로 넣으셔야 합니다!

yami654님의 프로필 이미지
yami654
질문자

감사합니다 해결했어요!!

yami654님의 프로필 이미지
yami654

작성한 질문수

질문하기