I want a column of 4 boxes, that are responsive and also stay in the center of the page, the rest is explained in the comments of the code
I found a solution but it prevents it from being in the center, I included everything in the code i tried.
- This resizes it but it prevents it from being in the center for some reason.
/* THIS RESIZES IT, BUT PREVENTS IT FROM BEING IN THE CENTER FOR SOME REASON */
.wrapper {
display: grid;
grid-template-columns: 1fr;
grid-template-rows: 1fr 1fr 1fr 1fr;
grid-template-areas: "1" "2" "3" "4";
position: relative;
top: 25rem;
left: 50%;
transform: translate(-50%, -50%);
}
.wrap {
min-width: 30rem;
max-width: 60rem;
padding: 2rem;
margin: 1rem;
border: 3px solid #fff;
background-color: #c8e6c9;
}
<div class="wrapper">
<div class="wrap">1</div>
<div class="wrap">2</div>
<div class="wrap">3</div>
<div class="wrap">4</div>
</div>
- this is perfect, but doesn't resize it
/* THIS IS PERFECT, EXCEPT IT DOESN'T RESIZE IT */
.wrapper {
display: grid;
grid-template-columns: 1fr;
grid-template-rows: 1fr 1fr 1fr 1fr;
grid-template-areas: "1" "2" "3" "4";
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.wrap {
min-width: 30rem;
max-width: 60rem;
padding: 2rem;
margin: 1rem;
border: 3px solid #fff;
background-color: #c8e6c9;
}
<div class="wrapper">
<div class="wrap">1</div>
<div class="wrap">2</div>
<div class="wrap">3</div>
<div class="wrap">4</div>
</div>
Thanks a lot.