본문 바로가기
SiteType

사이트 만들기 (이미지 유형 - 03)

by 코딩 냠냠 2022. 8. 20.
728x90
반응형

사이트 만들기(이미지 유형 - 03)

큰이지 하나와 작은 이미지 여러개가 함께있는 사이트 유형을 만들 수 있습니다.



CSS

/* imageType */
.image__inner {
    display: grid;
    grid-template-areas: 
        "box1 box1 box2 box3"
        "box1 box1 box4 box5";
    grid-template-columns: 1fr 1fr 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    grid-gap: 20px;
}
.image {
    overflow: hidden;
    position: relative;
    transition: all 0.5s ease-in-out;
}
.image__inner .image:nth-child(1){
    grid-area: box1;
    background: url(img/imageType03_01.jpg);
    background-size: cover;
}
.image__inner .image:hover {
    transform: scale(1.03);
}
.image__inner .image:nth-child(2){
    grid-area: box2;
}
.image__inner .image:nth-child(3){
    grid-area: box3;
}
.image__inner .image:nth-child(4){
    grid-area: box4;
}
.image__inner .image:nth-child(5){
    grid-area: box5;
}
.image_desc {
    position: absolute;
    left: 0;
    bottom: -100%;
    width: 100%;
    backdrop-filter: blur(10px);
    background: rgba(34, 33, 33, 0.3);
    padding: 16px;
    box-sizing: border-box;
    transition: all 0.3s ease;
}
.image:hover .image_desc {
    bottom: 0;
}
.image_desc h3 {
    font-size: 20px;
    color: #fff;
}
.image_desc p {
    font-size: 16px;
    color: #fff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.image__sns {
    position: absolute;
    right: -100px;
    top: 10px;
}
.image__sns a {
    width: 36px;
    height: 36px;
    background: #fff;
    border-radius: 50%;
    display: block;
    margin-bottom: 5px;
    background: url(img/image_bg03_icon.svg) no-repeat;
}
.image__sns a:nth-child(2) {
    background-position: -50px 0; 
}
.image__sns a:nth-child(3) {
    background-position: -100px 0; 
}
.image__sns a:nth-child(4) {
    background-position: -150px 0; 
}
.image__sns a:nth-child(5) {
    background-position: -200px 0; 
}
.image:hover .image__sns {
    right: 10px;
    transition: all 0.4s ease;
}

.image__inner {
    display: grid;
}

이미지 유형03에서는 grid를 이용해 레이아웃을 정렬 하였습니다.

HTML

<section id="imageType03" class="image__wrap gowun section">
    <h2>바다 생물의 여행</h2>
    <p>바다 생물들은 어떻게 지내고 있을까요? 살펴보도록 해요</p>
    <div class="image__inner container-fluid">
        <article class="image">
            <!-- <figure class="image__box">
                <img src="img/imageType03_01.jpg" alt="">
            </figure> -->
            <div class="image_desc">
                <h3>Shark</h3>
                <p>기나긴 여행자</p>
            </div>
            <div class="image__sns">
                <a href="#" class="link"><span class="ir">링크</span></a>
                <a href="#" class="link"><span class="ir">트위터</span></a>
                <a href="#" class="link"><span class="ir">인슽타그램</span></a>
                <a href="#" class="link"><span class="ir">유튜브</span></a>
                <a href="#" class="link"><span class="ir">페이스북</span></a>
            </div>
        </article>
    </div>
</section>

결과


댓글


자바스크립트

Javascript

자세히 보기
html
css
광고 준비중입니다.
<