Vissza a webes elemekhez
Galériák és képek

Rétegzett képek – Elegáns kompozíció

Élő előnézet – a komponens teljes méretben.

Élő előnézet
HTML · CSS · JS
HTML
<section class="we-photo-layer">
    <div class="we-photo-layer__inner">

        <div class="we-photo-layer__copy">
            <span class="we-photo-layer__eyebrow">
                KÉPEK • HANGULATOK • TÖRTÉNETEK
            </span>

            <h2>
                Terek, fények,<br>
                <em>formák.</em>
            </h2>

            <p>
                Néha egyetlen kép is elég ahhoz,
                hogy egy egész világot megmutasson.
            </p>

            <span class="we-photo-layer__signature">
                VIZUÁLIS KOMPOZÍCIÓ / 001
            </span>
        </div>

        <div class="we-photo-layer__visual"
             aria-label="Egymásra rétegzett építészeti fotók">

            <div class="we-photo-layer__photo we-photo-layer__photo--back">
                <img
                    src="https://images.unsplash.com/photo-1487958449943-2429e8be8625?auto=format&amp;fit=crop&amp;w=1000&amp;q=85"
                    alt="Modern épület letisztult formákkal"
                    loading="lazy">
            </div>

            <div class="we-photo-layer__photo we-photo-layer__photo--front">
                <img
                    src="https://images.unsplash.com/photo-1600607687939-ce8a6c25118c?auto=format&amp;fit=crop&amp;w=1000&amp;q=85"
                    alt="Elegáns, világos modern belső tér"
                    loading="lazy">
            </div>

            <div class="we-photo-layer__photo we-photo-layer__photo--small">
                <img
                    src="https://images.unsplash.com/photo-1511818966892-d7d671e672a2?auto=format&amp;fit=crop&amp;w=700&amp;q=85"
                    alt="Különleges építészeti részlet"
                    loading="lazy">
            </div>

            <div class="we-photo-layer__number">
                <span>01</span>
                <span class="we-photo-layer__number-line"></span>
                <span>03</span>
            </div>

        </div>
    </div>
</section>
CSS
/* =========================================
   WEBELEMENTS – RÉTEGEZETT KÉPEK
   Önálló, újra felhasználható elem
========================================= */

.we-photo-layer {
    --wpl-bg: #f1eee7;
    --wpl-text: #242820;
    --wpl-muted: #77786f;
    --wpl-accent: #a28b60;

    position: relative;
    width: 100%;
    overflow: hidden;
    padding: clamp(42px, 7vw, 96px) clamp(20px, 5vw, 76px);
    background: var(--wpl-bg);
    color: var(--wpl-text);
    box-sizing: border-box;
    isolation: isolate;
}

.we-photo-layer *,
.we-photo-layer *::before,
.we-photo-layer *::after {
    box-sizing: border-box;
}

.we-photo-layer__inner {
    width: 100%;
    max-width: 1240px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
    align-items: center;
    gap: clamp(35px, 7vw, 100px);
}

/* SZÖVEGES RÉSZ */

.we-photo-layer__copy {
    position: relative;
    z-index: 2;
    max-width: 440px;
}

.we-photo-layer__eyebrow {
    display: inline-block;
    margin-bottom: 24px;
    color: var(--wpl-accent);
    font: 700 10px/1.6 Arial, sans-serif;
    letter-spacing: 0.2em;
}

.we-photo-layer__copy h2 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(40px, 5.2vw, 72px);
    font-weight: 400;
    line-height: 0.99;
    letter-spacing: -0.045em;
}

.we-photo-layer__copy h2 em {
    color: var(--wpl-accent);
    font-weight: 400;
}

.we-photo-layer__copy p {
    max-width: 340px;
    margin: 28px 0 32px;
    color: var(--wpl-muted);
    font: 400 15px/1.9 Arial, sans-serif;
}

.we-photo-layer__signature {
    display: inline-block;
    padding-top: 13px;
    border-top: 1px solid rgba(162, 139, 96, 0.5);
    color: var(--wpl-muted);
    font: 700 9px/1.5 Arial, sans-serif;
    letter-spacing: 0.16em;
}

/* KÉPKOMPOZÍCIÓ */

.we-photo-layer__visual {
    position: relative;
    width: 100%;
    max-width: 620px;
    aspect-ratio: 1 / 0.92;
    margin: 0 auto;
}

.we-photo-layer__photo {
    position: absolute;
    overflow: hidden;
    background: #ddd9cf;
    box-shadow: 0 18px 55px rgba(30, 32, 26, 0.15);
}

.we-photo-layer__photo img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.8s cubic-bezier(.2, .7, .2, 1);
}

/* HÁTSÓ, NAGY KÉP */

.we-photo-layer__photo--back {
    top: 3%;
    right: 2%;
    width: 72%;
    height: 76%;
    transform: rotate(4deg);
}

/* ELÜLSŐ KÉP */

.we-photo-layer__photo--front {
    left: 3%;
    bottom: 5%;
    width: 67%;
    height: 68%;
    z-index: 2;
    border: 7px solid var(--wpl-bg);
    transform: rotate(-4deg);
}

/* KISEBB, RÁÜLŐ KÉP */

.we-photo-layer__photo--small {
    right: 0;
    bottom: 2%;
    width: 35%;
    height: 33%;
    z-index: 3;
    border: 5px solid var(--wpl-bg);
    transform: rotate(3deg);
}

/* DISZKRÉT SORSZÁM */

.we-photo-layer__number {
    position: absolute;
    z-index: 4;
    top: 0;
    left: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--wpl-accent);
    font: 700 10px/1 Arial, sans-serif;
    letter-spacing: 0.12em;
}

.we-photo-layer__number-line {
    display: block;
    width: 35px;
    height: 1px;
    background: var(--wpl-accent);
}

/* FINOM MOZGÁS */

@media (hover: hover) {
    .we-photo-layer__visual:hover
    .we-photo-layer__photo img {
        transform: scale(1.055);
    }

    .we-photo-layer__visual:hover
    .we-photo-layer__photo--back {
        transform: rotate(2deg) translateY(-3px);
    }

    .we-photo-layer__visual:hover
    .we-photo-layer__photo--front {
        transform: rotate(-2deg) translateY(2px);
    }

    .we-photo-layer__visual:hover
    .we-photo-layer__photo--small {
        transform: rotate(1deg) translateY(-4px);
    }

    .we-photo-layer__photo--back,
    .we-photo-layer__photo--front,
    .we-photo-layer__photo--small {
        transition: transform 0.5s ease;
    }
}

/* TABLET */

@media (max-width: 800px) {
    .we-photo-layer__inner {
        grid-template-columns: 1fr;
        gap: 50px;
    }

    .we-photo-layer__copy {
        max-width: 600px;
    }

    .we-photo-layer__visual {
        width: 100%;
        max-width: 560px;
    }
}

/* MOBIL */

@media (max-width: 480px) {
    .we-photo-layer {
        padding: 42px 20px 50px;
    }

    .we-photo-layer__inner {
        gap: 38px;
    }

    .we-photo-layer__copy h2 {
        font-size: clamp(38px, 11vw, 52px);
    }

    .we-photo-layer__copy p {
        margin: 20px 0 26px;
        font-size: 14px;
    }

    .we-photo-layer__visual {
        width: 100%;
        aspect-ratio: 0.94 / 1;
    }

    .we-photo-layer__photo--back {
        width: 77%;
        height: 72%;
    }

    .we-photo-layer__photo--front {
        width: 72%;
        height: 65%;
        border-width: 5px;
    }

    .we-photo-layer__photo--small {
        width: 39%;
        height: 31%;
        border-width: 4px;
    }
}

/* MOZGÁSCSÖKKENTÉS BEÁLLÍTÁSA */

@media (prefers-reduced-motion: reduce) {
    .we-photo-layer *,
    .we-photo-layer *::before,
    .we-photo-layer *::after {
        transition: none !important;
        animation: none !important;
    }
}
JavaScript
Ehhez az elemhez nincs külön JavaScript.