Dale Rollinson
Dale Rollinson

Reputation: 308

Aspect ratio media queries for any browser

I've been looking at media queries to adjust background-size from 'contain' to 'cover' when the browser width creates an aspect ratio of less than 4:3.

The effect is to deliver a background image which no longer displays in its entirety, but at least fills the screen for a professional look.

There is a selector 'device-aspect-ratio', but this is not well-supported.

Is there some kind of work around that avoids giving declarations for various device screen dimensions?

Upvotes: 0

Views: 186

Answers (1)

nietonfir
nietonfir

Reputation: 4881

No workaround afaik. You could resort to a javascript solution if that's an option for you that toggles a class.

Upvotes: 1

Related Questions