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

Kép a képben – Kreatív fotókompozíció

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

Élő előnézet
HTML · CSS · JS
HTML
<section class="kepben-kompozicio">
    <div class="kepben-hatter">
        <img
            src="https://images.unsplash.com/photo-1470770841072-f978cf4d019e?auto=format&fit=crop&w=1400&q=85"
            alt="Hegyek és tó naplementében"
            class="kepben-nagy-kep"
        >

        <div class="kepben-sotetites"></div>

        <div class="kepben-szoveg">
            <span class="kepben-felirat">A természet nyugalma</span>
            <h2>A pillanat,<br>ami megmarad.</h2>
            <p>
                Vannak helyek, ahol lelassul az idő,
                és végre észrevesszük a világ apró csodáit.
            </p>
            <a href="#felfedezes" class="kepben-gomb">
                Felfedezem
                <span aria-hidden="true">↗</span>
            </a>
        </div>
    </div>

    <div class="kepben-kis-kep">
        <img
            src="https://images.unsplash.com/photo-1441974231531-c6227db76b6e?auto=format&fit=crop&w=800&q=85"
            alt="Napfényben fürdő erdei ösvény"
        >
        <div class="kepben-kep-alairas">
            <span>01 / 03</span>
            <span>A csend ösvénye</span>
        </div>
    </div>

    <div class="kepben-diszvonal"></div>
</section>
CSS
.kepben-kompozicio {
    --kepben-arany: #d8bd86;
    --kepben-feher: #fffdf8;

    position: relative;
    isolation: isolate;
    width: 100%;
    min-height: 610px;
    padding: 55px 5%;
    box-sizing: border-box;
    overflow: hidden;
    background: #171d19;
    color: var(--kepben-feher);
    font-family: Georgia, "Times New Roman", serif;
}

/* NAGY HÁTTÉRKÉP */

.kepben-hatter {
    position: relative;
    width: 82%;
    min-height: 500px;
    margin-left: auto;
    overflow: hidden;
    background: #29352d;
}

.kepben-nagy-kep {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 55%;
    transition: transform 1.2s ease;
}

.kepben-kompozicio:hover .kepben-nagy-kep {
    transform: scale(1.035);
}

.kepben-sotetites {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(
            90deg,
            rgba(12, 19, 15, 0.83) 0%,
            rgba(12, 19, 15, 0.48) 48%,
            rgba(12, 19, 15, 0.05) 100%
        );
}

/* SZÖVEG */

.kepben-szoveg {
    position: relative;
    z-index: 2;
    width: min(460px, 55%);
    padding: 85px 0 70px 8%;
}

.kepben-felirat {
    display: inline-block;
    margin-bottom: 22px;
    color: var(--kepben-arany);
    font-family: Arial, sans-serif;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 4px;
    text-transform: uppercase;
}

.kepben-szoveg h2 {
    margin: 0 0 24px;
    color: var(--kepben-feher);
    font-size: clamp(38px, 5vw, 66px);
    font-weight: 400;
    line-height: 1.08;
    letter-spacing: -1.5px;
}

.kepben-szoveg p {
    max-width: 360px;
    margin: 0 0 32px;
    color: rgba(255, 253, 248, 0.82);
    font-family: Arial, sans-serif;
    font-size: 15px;
    line-height: 1.9;
}

/* GOMB */

.kepben-gomb {
    display: inline-flex;
    align-items: center;
    gap: 25px;
    padding: 14px 0;
    border-bottom: 1px solid var(--kepben-arany);
    color: var(--kepben-feher);
    font-family: Arial, sans-serif;
    font-size: 12px;
    letter-spacing: 1.5px;
    text-decoration: none;
    transition: color 0.3s ease, gap 0.3s ease;
}

.kepben-gomb span {
    color: var(--kepben-arany);
    font-size: 19px;
    transition: transform 0.3s ease;
}

.kepben-gomb:hover {
    gap: 34px;
    color: var(--kepben-arany);
}

.kepben-gomb:hover span {
    transform: translate(3px, -3px);
}

/* ELŐTÉRBE HELYEZETT KISEBB KÉP */

.kepben-kis-kep {
    position: absolute;
    z-index: 3;
    top: 115px;
    left: 7%;
    width: 30%;
    max-width: 350px;
    padding: 9px;
    background: #f6f0e5;
    box-shadow: 0 22px 65px rgba(0, 0, 0, 0.35);
    transform: rotate(-3deg);
    transition: transform 0.5s ease;
}

.kepben-kompozicio:hover .kepben-kis-kep {
    transform: rotate(0deg) translateY(-5px);
}

.kepben-kis-kep img {
    display: block;
    width: 100%;
    height: 310px;
    object-fit: cover;
}

.kepben-kep-alairas {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 13px 5px 5px;
    color: #343a32;
    font-family: Arial, sans-serif;
    font-size: 10px;
}

.kepben-kep-alairas span:first-child {
    color: #9b8050;
    letter-spacing: 1px;
}

.kepben-kep-alairas span:last-child {
    text-align: right;
}

/* DEKORATÍV VONAL */

.kepben-diszvonal {
    position: absolute;
    z-index: 4;
    right: 4%;
    bottom: 28px;
    width: 110px;
    height: 1px;
    background: var(--kepben-arany);
    opacity: 0.8;
}

/* TABLET */

@media (max-width: 900px) {
    .kepben-kompozicio {
        min-height: 570px;
        padding: 40px 4%;
    }

    .kepben-hatter {
        width: 88%;
        min-height: 480px;
    }

    .kepben-szoveg {
        width: 60%;
        padding: 85px 0 60px 10%;
    }

    .kepben-kis-kep {
        top: 145px;
        left: 3%;
        width: 32%;
    }

    .kepben-kis-kep img {
        height: 250px;
    }
}

/* MOBIL */

@media (max-width: 600px) {
    .kepben-kompozicio {
        min-height: auto;
        padding: 25px 18px 55px;
    }

    .kepben-hatter {
        width: 100%;
        min-height: 440px;
    }

    .kepben-sotetites {
        background: linear-gradient(
            90deg,
            rgba(12, 19, 15, 0.8),
            rgba(12, 19, 15, 0.3)
        );
    }

    .kepben-szoveg {
        width: 85%;
        padding: 55px 20px 45px;
    }

    .kepben-szoveg h2 {
        font-size: clamp(36px, 10vw, 48px);
    }

    .kepben-szoveg p {
        font-size: 14px;
        line-height: 1.8;
    }

    .kepben-kis-kep {
        position: relative;
        top: auto;
        left: auto;
        width: 68%;
        max-width: none;
        margin: -55px 0 0 8%;
        transform: rotate(-2deg);
    }

    .kepben-kis-kep img {
        height: 230px;
    }

    .kepben-kompozicio:hover .kepben-kis-kep {
        transform: rotate(0deg);
    }

    .kepben-diszvonal {
        right: 18px;
        bottom: 22px;
        width: 65px;
    }
}

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

@media (prefers-reduced-motion: reduce) {
    .kepben-nagy-kep,
    .kepben-kis-kep,
    .kepben-gomb,
    .kepben-gomb span {
        transition: none;
    }
}
JavaScript
Ehhez az elemhez nincs külön JavaScript.