Orientation Change adds margin/padding - css

singforpleasure.nicktoye.co.uk on the iPhone/mobile device breaks the layout when you go from portrait to landscape to portrait. When you return to portrait it adds some extra spacing to the right.
Is this a bug?

You must adapt the meta viewport to:
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
Then it should be fine.

Related

Shrink the entire view when resizing the window

I want to shrink the entire view when resizing the window. In mobile view, the view should be a shrunken version of the desktop view. Something similar to the https://www.cbioportal.org/ website. If we resize, the entire view is being shrunken. In the frontend i'm using Angular and bulma. How could I achieve this?
Don't use the "responsive" meta tag:
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
This will revert to default behavior of browser which shows the entire viewport width.

match pixel size of element on iOS screen with CSS

I am trying to create a notification container with CSS that is the same size as notifications on iOS on my iPhone 6S.
I have created screen grabs of portrait and landscape. When I view the images the sizes of the notifications in pixels are 718x262 and 841x262 respectively.
When I create the notifications with the same height (262px) they are displayed on the device differently 200px in portrait and 357px in landscape).
https://www.dropbox.com/sh/bmkv2gua62r4zly/AAC0xPZIURWZFwCb9pFzDk1Da?dl=0
Adding viewport meta tags fixed the issue
<meta name="viewport" content="width=device-width">
<meta name="viewport" content="initial-scale=1.0">

Using viewport to force all screens to 640px wide

I am trying to force all mobile devices to have a rendered screen size of 640px wide. I've used:
<meta name="viewport" content="width=640">
Unfortunately, when I emulate screen resolutions in Chrome, the page sizes completely differently between different devices.
If I emulate a Note 3, it looks far different than an iPhone 4.
I've also tried doing:
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
But this only works for any screen who's initial scale or pixel ratio is set correctly. For example, the note3 has to be set to initial-scale=.5623 for the page to look like it's 640px wide, but that's not the case for the iphone.
What am I missing??

initial zoom depending on device resolution

I would like to adjust initial zoom level for mobile devices(or certain resolutions) so that the content doesn't expand beyond the view space.
Is there an easier way than using media queries?
thanks
This will adjust your website to device width and remove user zoom:
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;" name="viewport" />
Note: don't use maximum-scale if you still want your users to be able to zoom.

Mobile resolution and CSS aspect ratio

I'm building web application using RWD. I've written media queries for different resolutions say 1024, 768 and 320.
I'm using below metatag to decide page width
<meta name="viewport" content="width=device-width, initial-scale=1" />
There are few devices e.g. iPhone 5 with resolution - 1136×640. When I'm opening my webpage in iPhone its displaying 320 layout in landscape mode where as its resolution says its 1136px wide.
I know it has CSS pixel ratio as 2 but not sure logic between CSS pixel ratio, media query width and device resolution calculation.
Is there are any article or link that explains this and will tell why its displaying 320 layout for iPhone.
Thanks in advanced.
Try using this meta declaration instead:
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">

Resources