Is viewport preferable over media queries because it sets the size of an element based on the actual device screen vs pixel density? : web_design

By Prosyscom
In March 8, 2018
74 Views


Hi guys, been working on setting up css for a parallax effect on images for my company’s content team but I’m getting mixed messages on whether or not I should use media queries.

It’s my understanding viewport is a very good catch-all for setting the height and width of elements because different devices have different screen pixel-densities. Is that correct or am I confused. I’m trying to make sure the image sizes the way it’s supposed to across mobile and desktop but I’ve been unsure if I should be using media queries. The parallax effect is only for desktop. On mobile it just shows the regular image.

(speaking of which does anyone know if it’s possible to achieve the parallax effect on mobile without it using javascript?)

I just can’t seem to find a concrete answer on why you’d use media queries when viewport height/width does essentially the same thing right?

Anyone have any perspective or information they could provide?

قالب وردپرس