+ 2

How?

How can I get the div with id test to have a square shape and a width of 60% of the screen? How do I program the height to be the same as the width? Thanks. #transferAlert { width: 60%; height: ?????; }

14th Nov 2023, 8:30 PM
JonySVK
JonySVK - avatar
2 Answers
+ 6
you can use aspect-ratio https://developer.mozilla.org/en-US/docs/Web/CSS/aspect-ratio #transferAlert { width: 60%; aspect-ratio: 1; }
14th Nov 2023, 9:45 PM
Bob_Li
Bob_Li - avatar
+ 2
Bob_Li Thank you very much. Your solution works.
15th Nov 2023, 6:53 AM
JonySVK
JonySVK - avatar