There doesn’t appear to be a way to figure out the aspect ratio of the viewport in CSS. (CSS `calc()` divisions require a number as right-hand argument, so I can’t just divide two lengths like 1vw and 1vh).
Gotta resort to JavaScript, sigh.
There doesn’t appear to be a way to figure out the aspect ratio of the viewport in CSS. (CSS `calc()` divisions require a number as right-hand argument, so I can’t just divide two lengths like 1vw and 1vh).
Gotta resort to JavaScript, sigh.
@indrora no, I need to calculate the aspect ratio, not set it
@thomasfuchs https://css-tricks.com/aspect-ratio-boxes/ https://developer.mozilla.org/en-US/docs/Web/CSS/aspect-ratio does this help?
@indrora to calculate the aspect ratio of the viewport
@thomasfuchs what's your goal?
@indrora `/` needs a number as right hand argument, the calc here is returning a length
@thomasfuchs For what purpose?
`calc(calc(0%+1vh) / calc(0%+1vw))` might get you there, since that avoids the Number As Argument, but I forget if you can stack calc() calls.
You can media-query against the aspect ratio, too: https://developer.mozilla.org/en-US/docs/Web/CSS/@media/aspect-ratio
@thomasfuchs I just miss how nice it was when WAP had XML descriptor url from the device to the backend showing screen ratio, pixel size, content size with a scrollbar etc.
@nemeciii I think my brain refuses to remember anything WAP
GNU social JP is a social network, courtesy of GNU social JP管理人. It runs on GNU social, version 2.0.2-dev, available under the GNU Affero General Public License.
All GNU social JP content and data are available under the Creative Commons Attribution 3.0 license.