I am trying to develop a vertical flexbox meant to be shown on mobile phones. The flexbox will have width spanning the entire width of the phone screen so I'll have it set with width: 100%
. I want one of the elements to be a square in dimensions meaning it will have the width of the flexbox which in this case will end up being the width of the phone screen and the height should be equal to that. The other elements in the flexbox will be normal without constraints. How can I accomplish this?
Asked
Active
Viewed 84 times
0

user782220
- 10,677
- 21
- 72
- 135
-
1Can you show us your code please? What have you tried? – Mosh Feu Aug 12 '18 at 06:30
-
is this question close to yours ? https://stackoverflow.com/questions/29307971/css-grid-of-squares-with-flexbox/29308467 – G-Cyrillus Aug 12 '18 at 08:08
1 Answers
0
there is a property named 'aspectRatio' , try this 'aspectRatio: 1' i.e style = "width 100%; aspectRatio : 1;"

DNA.h
- 823
- 8
- 17