N
N
Northern Lights2019-07-29 11:47:19
css
Northern Lights, 2019-07-29 11:47:19

Is it possible to make flex items "columns" but without specifying a width?

There are two views in which flex items should take up 33%, i.e. share 3 elements in a row, in another view - two elements in a row, 50% each. Well, like goods in IM.
Here is a blank - https://jsfiddle.net/w8kzdn6m/
Is it possible to somehow make universal css to avoid two classes specifying the width of the elements?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
B
Brad9aga, 2019-07-29
@php666

on pure flex, no, grids were invented for this, or manual media queries

K
Kudis, 2019-07-29
@kudis

Here is a version without a class, but with a media expression
https://jsfiddle.net/gcr4j3o8/
just change the width of the container with the result and you will see how after 900px everything ages 3 in a row, and up to 2 in a row.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question