Solution 1 :

Add a common class with img1, img2, img3, ….. which will take 50% of the parent container width.
like

.img {
    width: 50%;
    display: flex;
    justify-content: center;
}

And then

<section class="sub-section">
            <div class="img1 img">
                <div class="blank-containers"></div>
                <p>image One</p>
            </div>
            <div class="img2 img">
                <div class="blank-containers"></div>
                <p>image Two</p>
            </div>
            <div class="img3 img">
                <div class="blank-containers"></div>
                <p>image Three</p>
            </div>
..........
            </div>
        </section>
    </section>

Hope it will work for you.

Problem :

In my current desktop markup, I’m trying to add a 800px media query. In the desktop version, I have 2 rows of cards, that in the 800px bp, I want 2 columns of 4 cards each. How can I achieve this?

.sub-section .blank-containers {
    width: 250px;
    height: 250px;
    background: rgb(197, 179, 196);
    margin: 5px;
    display: flex;
    justify-content: space-evenly;
    border-radius: 10px;
    border: 1px solid;
}
.sub-section {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: space-evenly;
    margin-top: 10px;
    border: 1px solid;
}
@media (max-width: 800px) {
    section.sub-section {
        flex-direction: column;
        flex-wrap: wrap;
    }
}

<section class="sub-section">
            <div class="img1">
                <div class="blank-containers"></div>
                <p>image One</p>
            </div>
            <div class="img2">
                <div class="blank-containers"></div>
                <p>image Two</p>
            </div>
            <div class="img3">
                <div class="blank-containers"></div>
                <p>image Three</p>
            </div>
..........
            </div>
        </section>
    </section>

Comments

Comment posted by Rainbow

What your markup look like ?

Comment posted by mahiya17

I couldn’t post everything the first time, sorry but I just added it now

Comment posted by jsfiddle.net/75ytaLs8

With your current setup you can’t directly, So instead target the flex items and make them 50% of the parent’s width

Comment posted by mahiya17

I’ll try that, thank you

Comment posted by jsfiddle.net/75ytaLs8/1

If you can change the markup you can try nested flex containers, because flex only works in one direction at a time

Comment posted by mahiya17

super resourceful. Thank you

Comment posted by Shirsha Ghosh

Happy to help

By