S
S
sipans2021-11-17 20:21:00
css
sipans, 2021-11-17 20:21:00

How to split background into 2 css images?

How to split the background into 2 pictures horizontally, as shown in the photo6195399de74e6216408064.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Sinitsyn, 2021-11-17
@a_u_sinitsin

The simplest: two pictures are stitched into one, which is centered on the background ))
You can pervert with two blocks :before + :after %)

F
FrelFrloich, 2021-11-18
@FrelFrloich

<div class="container">
    <img class="img" src="" alt="">

    <div class="text-container">
        <!-- текст -->
    </div>
</div>

.container {
    display: flex;
    justify-content: center;

    width: 100%;
    height: 100vh;
}
.img {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;

    width: 100%;
    height: 100%;

    object-fit: cover;
}

.text-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 1320px;
}

if you really need two pictures
<div class="container">
    <img class="img" src="" alt="">
    <img class="img" src="" alt="">
    
    <div class="text-container">
        <!-- текст -->
    </div>
</div>

.container {
    display: flex;
    justify-content: center;

    width: 100%;
    height: 100vh;
}
.img {
    position: absolute;
    top: 0;
    bottom: 0;
    разделисть по сторонам картинки

    width: 50%;
    height: 100%;

    object-fit: cover;
}

.text-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 1320px;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question