Formatting for mobile devices

Asked

Viewed 68 times

0

I can use @media screen and (orientation:portrait) {} so that my code only works on mobile devices ?

'Cause I think cell phones and smartphones are the only ones who possess $(window).height() greater than $(window).width() or the height of the screen greater than the width.

  • Perhaps you’d better explain what you intend to do.

  • It is possible for height to be greater than width on desktops, many designers use the side-facing display to increase the vertical visual area for drawing. So this can’t be a determining factor for you to check whether or not it’s mobile. See @Lucas' reply below, with css is the best way

1 answer

1

No, because smartphones and tablets stay in Landscape when rotated. So it is good to specify also the limits in "px".

At this link has media queries standards for devices. But each layout is a layout, so it’s based on this pattern but tests the breakpoints of the page and edits the media queries however necessary.

You can do it manually by decreasing the size of the browser window using extensions (I use that one in Chrome) or websites as that.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.