Re:Just because I have a vertical screen doesn’t mean I’m on...
by eznzt on Tuesday February 02, 2021 @09:11AM
(#26001115)
Exactly. CSS does not check that your screen is taller than it is wide. What it sees is a narrow viewport.
[ Parent
| on HN ]
Re:Just because I have a vertical screen doesn’t mean I’m on...
by dairylee on Tuesday February 02, 2021 @10:33AM
(#26002115)
The CSS could very well be checking that
// The viewport is in a landscape orientation, i.e., the width is greater than the height.
@media (orientation: landscape)
// The viewport is in a portrait orientation, i.e., the height is greater than or equal to the width.
@media (orientation: portrait)
Re:Just because I have a vertical screen doesn’t mean I’m on...
by jkochis on Tuesday February 02, 2021 @09:22AM
(#26001223)
Is that what this is for? https://developer.mozilla.org/en-US/docs/Web/CSS/@media/aspe...
Re:Just because I have a vertical screen doesn’t mean I’m on...
by jefftk on Tuesday February 02, 2021 @09:28AM
(#26001280)
You can query for aspect ratio in CSS, yes. This can be useful for figuring out whether it's better to place something as, say, a sidebar vs a footer. The sites they are complaining about, however, are only looking at the horizontal dimension.
Re:Just because I have a vertical screen doesn’t mean I’m on...
by Nathanael_M on Tuesday February 02, 2021 @09:30AM
(#26001298)
I think primarily that's for constraining a div's aspect-ratio. Like making sure you have a div that's always 16:9 to hold a video player. I'd be interested in hearing other use cases, though.
Re:Just because I have a vertical screen doesn’t mean I’m on...
by madeofpalk on Tuesday February 02, 2021 @10:57AM
(#26002499)
No, it's not.
Re:Just because I have a vertical screen doesn’t mean I’m on...
by Nathanael_M on Tuesday February 02, 2021 @07:31PM
(#26009103)
I'd be interested in hearing other use cases.
Re:Just because I have a vertical screen doesn’t mean I’m on...
by madeofpalk on Tuesday February 02, 2021 @09:23PM
(#26009836)
The aspect ratio media query just lets you apply certain CSS to the page depending on the viewport aspect ration. It does not set an aspect ratio on an element.
Maybe there’s something I’m missing, but I’m not sure how knowing the aspect ratio of the screen would help make an element 16:9. If my browser is narrower or wider, that doesn’t affect how I would style the element.
Re:Just because I have a vertical screen doesn’t mean I’m on...
by Nathanael_M on Wednesday February 03, 2021 @09:26AM
(#26013817)
Oh, sorry, I was reading an article about the new CSS aspect-ratio property and mixed it up with the CSS aspect-ratio media query.