3

I have such container

    #container{
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    }

of such items

    .picture_tile{
        width:200px;
        height: 200px;
        position: relative;
        background: white;
        color: black;
        margin: auto;
    }

it adjusts nicely horizontally. It nicely adjusts while scaling my monitor, is it possible to apply space between the images to rows as well? I am total beginner to CSS. Is it possible to apply the same space that is changing between the items on vertical gap? When I scale my monitor and the items' horizontal gap is anything between 10-50px. Can the same change apply on vertical gap while changing horizontal size of my window? I hope it's understandable. I only want to have perfect grid with perfect gaps, everything same, but the content would be dynamic and behave like when display: grid is applied

1 Answer 1

1

You can use grid-gap: value property on your #container

Sign up to request clarification or add additional context in comments.

4 Comments

well, and how you set it dynamically so it copies horizontal spaces between the items?
@Jansindl3r suppose you set grid-gap:20px, it sets equal 20px grid-row-gap and grid-column-gap; you can set them separately too....
It has been a long search but I managed to do it. jansindl3r.github.io/renata (after 10secs of being on that page) hmm I don't even remember how I did it. But padding-top 100% keeps the div squarish. I will post a proper answer in case some other people want to do the same
Now the gaps are fixed, but I tried different approach where the squares stayed the same width and height and the gaps would change.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.