BaseCamp 2주 5일차

배운 것의 중요한 부분

1. Flex는 1차원 구조 -> Grid는 2차원 구조

2. 요소 속성을 grid = display: grid로 변경


BaseCamp 2주 5일차 1
1층

3. grid-template-row = 그리드 행의 계수와 크기를 지정할 수 있습니다. B.) 그리드 템플릿 행 : 1fr 2fr 200px

4. grid-template-colums = 그리드 열의 계수 및 크기를 지정할 수 있습니다. B.) 그리드-템플릿-열 : 1fr 2fr 200px

5. fr = 그리드 템플릿에서 사용할 수 있는 백분율 단위인 Fraction의 약어

6. repeat(a, b) = 그리드 템플릿에서 사용할 수 있는 반복 기능에 대한 b 표준의 그리드 템플릿을 만듭니다.

예) 그리드 템플릿 열: repeat(4, 1fr) = 그리드 템플릿 열: 1fr 1fr 1fr 1fr

7. 그리드 템플릿의 예


BaseCamp 2주 5일차 2


BaseCamp 2주 5일차 3

8. grid-colum / grid-row = 그리드 요소가 차지하는 영역을 정의합니다. 예) 그리드 열: 1/3


BaseCamp 2주 5일차 4

9. 플렉스 대 그리드

Flex = 상대적으로 작은 유닛 레이아웃 구성에 적합, 작업의 유연성이 높음, 디자인 및 기획이 명확하게 정의되지 않고 변경될 수 있음

잠재력이 있다면 충분합니다.

그리드 = 대면적 레이아웃에 적합, 레이아웃 구조가 명확하게 명시되어 있으면 효율적으로 반응형 디자인 구현 가능

10. 미디어 할당량이란 무엇입니까? 뷰포트의 너비에 따라 웹사이트의 스타일 시트를 변경할 수 있습니다.

11. BreakPoint = 반응형 웹사이트 작업의 기본이 되는 중단점을 말합니다.


BaseCamp 2주 5일차 5

12. max-width & max-height = 요소의 최대 너비 또는 높이를 설정합니다.

13. min-width & min-height = 요소의 최소 너비 또는 높이를 설정합니다.

14. max() = 속성 값으로 괄호 안에 입력된 값 중 가장 큰 값을 반환하는 함수.

15. min() = 괄호 안에 입력된 값 중 가장 낮은 값을 속성 값으로 반환하는 함수.

그날의 감정

이번주에는 일주일간의 과제를 모아서 마지막 과제를 진행했습니다. 코드와 동영상을 첨부하고 싶습니다.

명제

<!DOCTYPE html>
<html lang="ko">
<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>Welcome to my shop</title>
    <link rel="stylesheet" href="http://choisdevbox.m/./index.css">
</head>
<body>
    <section class="mainBanner">
        <h1 class="text">Welcome to my shop</h1>
    </section>
    <div class="container">
        <section class="wrapper">
            <div class="sidebar">
                <div class="mainMenu">
                    <ul>
                        <li><a href="">New items</a></li>
                        <li><a href="">Best items</a></li>
                        <li><a href="">상품 목록</a></li>
                        <li><a href="">중고 마켓</a></li>
                    </ul>
                </div>
                <div class="writeBtnBox">
                    <button class="writeBtn">상품 등록 <span class="arrow">></span></button>
                </div>
            </div>
            <div class="itemWrap">
                <div class="item">
                    <div class="imgBox">
                        <img src="./img/item1.jpeg" alt="탁상용 조명">
                    </div>
                    <div class="textBox">
                        <p class="textBox_name">탁상용 조명</p>
                        <p class="textBox_price">100.000</p>
                    </div>
                </div>
                <div class="item">
                    <div class="imgBox">
                        <img src="./img/item2.png" alt="머그컵">
                    </div>
                    <div class="textBox">
                        <p class="textBox_name">머그컵</p>
                        <p class="textBox_price">10.000</p>
                    </div>
                </div>
                <div class="item">
                    <div class="imgBox">
                        <img src="./img/item3.jpeg" alt="홈 슬리퍼">
                    </div>
                    <div class="textBox">
                        <p class="textBox_name">홈 슬리퍼</p>
                        <p class="textBox_price">20.000</p>
                    </div>
                </div>
                <div class="item">
                    <div class="imgBox">
                        <img src="./img/item1.jpeg" alt="탁상용 조명">
                    </div>
                    <div class="textBox">
                        <p class="textBox_name">탁상용 조명</p>
                        <p class="textBox_price">100.000</p>
                    </div>
                </div>
                <div class="item">
                    <div class="imgBox">
                        <img src="./img/item1.jpeg" alt="탁상용 조명">
                    </div>
                    <div class="textBox">
                        <p class="textBox_name">탁상용 조명</p>
                        <p class="textBox_price">100.000</p>
                    </div>
                </div>
                <div class="item">
                    <div class="imgBox">
                        <img src="./img/item2.png" alt="머그컵">
                    </div>
                    <div class="textBox">
                        <p class="textBox_name">머그컵</p>
                        <p class="textBox_price">10.000</p>
                    </div>
                </div>
                <div class="item">
                    <div class="imgBox">
                        <img src="./img/item3.jpeg" alt="홈 슬리퍼">
                    </div>
                    <div class="textBox">
                        <p class="textBox_name">홈 슬리퍼</p>
                        <p class="textBox_price">20.000</p>
                    </div>
                </div>
                <div class="item">
                    <div class="imgBox">
                        <img src="./img/item1.jpeg" alt="탁상용 조명">
                    </div>
                    <div class="textBox">
                        <p class="textBox_name">탁상용 조명</p>
                        <p class="textBox_price">100.000</p>
                    </div>
                </div>
                <div class="item">
                    <div class="imgBox">
                        <img src="./img/item1.jpeg" alt="탁상용 조명">
                    </div>
                    <div class="textBox">
                        <p class="textBox_name">탁상용 조명</p>
                        <p class="textBox_price">100.000</p>
                    </div>
                </div>
                <div class="item">
                    <div class="imgBox">
                        <img src="./img/item2.png" alt="머그컵">
                    </div>
                    <div class="textBox">
                        <p class="textBox_name">머그컵</p>
                        <p class="textBox_price">10.000</p>
                    </div>
                </div>
                <div class="item">
                    <div class="imgBox">
                        <img src="./img/item3.jpeg" alt="홈 슬리퍼">
                    </div>
                    <div class="textBox">
                        <p class="textBox_name">홈 슬리퍼</p>
                        <p class="textBox_price">20.000</p>
                    </div>
                </div>
                <div class="item">
                    <div class="imgBox">
                        <img src="./img/item1.jpeg" alt="탁상용 조명">
                    </div>
                    <div class="textBox">
                        <p class="textBox_name">탁상용 조명</p>
                        <p class="textBox_price">100.000</p>
                    </div>
                </div>
            </div>
        </section>
    </div>
</body>
</html>

*{
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

a {
    text-decoration: none;
}

.mainBanner {
    width: 100%;
    height: 280px;
    background-image: url(./img/banner.jpg);
    background-size: cover;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
}

.mainBanner .text {
    font-size: 42px;
    font-weight: 700;
    color: white;
    text-shadow: 2px 2px 5px rgba(0, 0, 0, 0.3);
    animation: titleText 1s ease-in-out;
}

@keyframes titleText {
    0% {
        transform: translateY(70px);
        opacity: 0;
    }
    92% {
        transform: translateY(-10px);
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}
.mainBanner .text {
    font-size: 48px;
}

.container {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: flex-st;

}

.wrapper {
    width: 100%;
    max-width: 1320px;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0 10px;
}

.sidebar {
    width: 170px;
}

.mainMenu {
    background-color: orange;
    border-radius: 5px;
    padding: 10px 15px;
}

.mainMenu ul {
    display: block;
    padding: 0;
}

.mainMenu ul li {
    display: block;
    list-style: none;
}

.mainMenu ul li a {
    display: block;
    padding: 10px;
    color: white;
    border-radius: 20px;
    transition: all 0.3s ease-in-out;
}

.writrBtnBox {

}

.writeBtn {
    width: 100%;
    background-color: black;
    border: 1px solid black;
    color: #ffffff;
    padding: 10px 20px;
    margin-top: 10px;
    text-align: left;
    font-size: 16px;
    transition: all 0.3s ease-in-out;
}


.writeBtn .arrow {
    display: inline-block;
    padding-left: 10px;
    transition: all 0.3s ease-in-out;
}

.writeBtn:hover .arrow {
    transform: translateX(50px);
}

.itemWrap {
    width: calc(100% - 170px);
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    padding-left: 15px;

}

.item {
    width: calc(25% - 10px);
    aspect-ratio: 6 / 5;
    position: relative;
    overflow: hidden;
    border-radius: 15px;
    margin-bottom: 15px;
    
}

.imgBox {
    width: 100%;
    height: 100%;
}

.imgBox img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.textBox {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: flex-start;
    padding: 20px;
    z-index: 3;
}

.textBox p {
    color: white;
    margin: 5px 0 0;
}

.textBox_name {
    font-size: 22px;
    font-weight: 500;
    opacity: 0;
    transform: translateY(50px);
}

.textBox_price {
    font-size: 16px;
    font-weight: 400;
    opacity: 0;
    transform: translateY(50px);
}

.item:after {
    content: "";
    display: block;
    background: rgba(0,0,0,0.2);
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
    opacity: 0;
}


.item::after,
.item .imgBox img,
.item .textBox_name,
.item .textBox_price {
    transition: all 0.4s ease-in-out;
}

.item .textBox_price {
    transition: all 0.4s ease-in-out 0.15s;
}

@media screen and (max-width: 767px) {
    /* mobile */
    .mainBanner {
        height: 160px;
        margin-bottom: 0;
    }

    .mainBanner .text {
        font-size: 26px;
    }

    .wrapper {
        flex-direction: column;
        padding: 0;
    }

    .sidebar {
        width: 100%;

    }

    .mainMenu {
        padding: 0;
        border-radius: 0;
    }

    .mainMenu ul {
        display: flex;
        flex-direction: row;
        justify-content: center;
        align-items: center;
        margin: 0;

    }

    .mainMenu ul li a {
        font-size: 14px;
        padding: 15px 10px;
    }

    .writeBtnBox {
        display: none;
    }

    .itemWrap {
        width: 100%;
        margin-top: 12px;
    }

    .item {
        width: calc(50% - 7px);
        overflow: visible;
        border: 1px solid #dddddd;
    }

    .textBox {
        width: 100%;
        height: auto;
        position: relative;
    }

    .textBox p {
        color: black;
    }

    .textBox_name {
        font-size: 18px;
        opacity: 1;
        transform: translateY(0);
    }

    .textBox_price {
        font-size: 12px;
        opacity: 1;
        transform: translateY(0);
    }
}

@media screen and (min-width: 768px) and (max-width: 1023px) {
    /* tablet */
    .item {
        overflow: visible;
        border: 1px solid #dddddd;
    }

    .textBox {
        width: 100%;
        height: auto;
        position: relative;
    }

    .textBox p {
        color: black;
    }

    .textBox_name {
        font-size: 18px;
        opacity: 1;
        transform: translateY(0);
    }

    .textBox_price {
        font-size: 12px;
        opacity: 1;
        transform: translateY(0);
    }
}

@media screen and (min-width: 1024px) {
    .item:hover .imgBox img {
        transform: scale(1.1);
        filter: blur(3px);
    }
    
    .item:hover:after {
        opacity: 1;
    }
    
    .item:hover .textBox_name {
        opacity: 1;
        transform: translateY(0);
    }
    
    .item:hover .textBox_price {
        opacity: 1;
        transform: translateY(0);
    }

    .mainMenu ul li a:hover {
        padding-left: 20px;
        background-color: rgb(255, 145, 0);
    }

    .writeBtn:hover {
        background-color: white;
        color: #333333;
    }
    
    .writeBtn:hover .arrow {
        transform: translateX(50px);
    }
}