퍼블리싱/html, css, javascript

네이버를 참조한 기본 쇼핑몰 상품 레이아웃 (두번째)

연지쁨 2023. 8. 9. 10:27
반응형

 

미리보기

 

 

 

<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>
#product-list {
	display: flex;
    flex-wrap: wrap;
	margint-top: 12px;
}

.product-card {
	width: 180px
    height: 300px;
    background-color: gray;
    margin-right: 12px;
    margin-bottom: 12px;
}

쇼핑몰 상품을 수직이 아닌 평행으로 나열하기

 

반응형

 

 

 

 

쇼핑몰상품 이미지 삽입, 상품명, 판매가 입력

 

 

<html>
    <head>
        <title>쇼핑몰 이름</title>
        <link href="index.css" type="text/css" rel="stylesheet" />
    </head>
    <body>
        <div id="header">
            <div id="header-area">
                <img src="상단 로고" />
            </div>
            </div>
        <div id="body">
        <div id="banner">
            <img src="상단 배너" />
        </div>
        <h1>판매 상품들</h1>
        <div id="product-list">
            <div class="product-card">
            <div>
            <img class="product-img" src="상품이미지" />
            </div>
        <div class="product-contents">
            <span class="product-name">상품명</span>
            <span class="product-price">가격</span>
            <div class="product-seller">
                <img class="product-avatar" src="판매자 아이콘" />
                <span>판매자 닉네임</span>
            </div>
            </div>
          </div>
        <div class="product-card">
            <div>
            <img class="product-img" src="상품이미지" />
            </div>
        <div class="product-contents">
            <span class="product-name">상품명</span>
            <span class="product-price">가격</span>
            <div class="product-seller">
                <img class="product-avatar" src="판매자 아이콘" />
                <span>판매자 닉네임</span>
            </div>
            </div>
          </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-top: 16px;
}
#product-list {
    display: flex;
    flex-wrap: wrap;
    margin-top: 12px;
}

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

.product-img {
    width: 100%;
    height: 210px;
}
.product-contents{
    display: flex;
    flex-direction: column;
    padding: 8px;
}
.product-name {
    font-size: 14px;
}
.product-price {
    font-size: 16px;
    font-weight: 600;
    margin-top: 4px;
}
.product-seller {
    display: flex;
    align-items: center;
    margin-top: 12px;
}

.product-avatar {
    width: 24px;
}

 

 

 

반응형