I've included a very basic snippet, which includes a row of flex items that collapses a column when the viewport width is less than 768px. If you open the snippet full page and then open the dev tools you can resize the viewport and see this happens as expected.
However, if you set the viewport with to something like 780px and zoom in just a bit (shift + click and drag on Chrome) the row does not collapse into a column like it does when you resize the screen itself. Is it possible to alter the layout in response to user initiated zooming in a trivial way (i.e. HTML, CSS no JS)? I am aware of media queries responding to zoom if the zoom level is set in em
, but that requires a page reload which is cumbersome and makes for pretty bad UX.
Here is a loom video showing what I mean.
.flex-responsive {
flex: 1;
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
}
@media screen and (max-width: 768px) {
.flex-responsive {
flex-direction: column;
}
}
<div class='flex-responsive'>
<div>item</div>
<div>item</div>
<div>item</div>
<div>item</div>
<div>item</div>
<div>item</div>
<div>item</div>
<div>item</div>
<div>item</div>
</div>