Let's say I have a flexbox that I fill with some squares...
const init = () => {
const container = document.querySelector('.container')
for(const i of Array(70).keys()){
const square = document.createElement('div')
square.classList.add('square')
container.appendChild(square)
}
}
init()
* {
box-sizing: border-box;
}
.container {
height: 100%;
width: 100%;
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: center;
align-items: center;
}
.square{
background-color: orange;
height: 8em;
width: 8em;
margin: .2em;
perspective: 1000px;
}
<div class="container">
</div>
I now want these squares to shrink until all fit into a non-scrolling container (while maintaining aspect ratio, of course).
How do I do that?