06/15 24차 트랜스폼 과제

Noh Sinyoung·2023년 6월 15일
0

과제

목록 보기
24/27
<!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>Document</title>
    <link rel="stylesheet" href="0615 트랜스폼.css">
</head>
<body>
    <div class="container">
        <div class="head"><h1>마우스 올리면 상세 설명 표시</h1></div>
        <div class="box">
            <div class="item"></div>
            <div class="text">
                <h2>플랑크톤1</h2>
                <p>*****</p>
            </div>
        </div>
        <div class="box">
            <div class="item"></div>
            <div class="text">
                <h2>플랑크톤2</h2>
                <p>*****</p>
            </div>
        </div>
        <div class="box">
            <div class="item"></div>
            <div class="text">
                <h2>플랑크톤3</h2>
                <p>*****</p>
            </div>
        </div>
    </div>

    <div class="footer">
        <h1>사용한 주요 CSS</h1>
        <p>display : flex</p>
        <p>overflow : hidden</p>
        <p>opacity (0 ~ 1)</p>
        <p>transition</p>
        <p>transform : translate(ㅇㅇ, ㅇㅇ)</p>
    </div>
</body>
</html>

=============================================================================

*{margin: 0; padding: 0; box-sizing: border-box;}
.container {
    width: 900px;
    margin-left: auto;
    margin-right: auto;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: 50px 200px;
    gap: 10px;
}

.head {
    position: relative;
    top: 15px;
    grid-column: 1/4;
    text-align: center;
}

.item {
    width: 300px;
    height: 200px;
    border: 1px solid black;
    background-image: url('https://preview.free3d.com/img/2017/09/2704957626197739490/3ywedicf.jpg');
    background-size: cover;
}

.box {
    overflow: hidden;
}

.text {
    position: relative;
    padding: 30px;
    text-align: center;
    width: 300px;
    height: 200px;
    background-color: rgba(0, 0, 0, 0.331);
    opacity: 0;
    transition: 0.1s;
}

.text > h2 {
    color: white;
}

.text > p {
    color: yellow;
}

.box:hover .text {
    opacity: 1;
    transform: translate(0, -200px);
}

.footer {
    background-color: aquamarine;
    text-align: center;
    margin-top: 20px;
}

0개의 댓글