I can do this in JavaScript easily enough, but would like to know if it's possible with straight CSS: keep a square div in a window that fits within the window size regardless of what that is.
Any solutions I've found do not account for the height becoming less than the width.
Logically speaking what I want is, when the window width is less than the height, give me a square of that width. If the height is less, then give me a square of that size.
The closest solution I've seen uses a width and height measured in vw, but it does not work when the window is very wide and short.