Copy link to clipboard
Copied
I'm adapting a desktop layout for mobile, and what should be a useful feature -- ie, mobile devices' ability to auto-fit layouts that would otherwise be too large into the viewport -- is proving to be an obstacle. Basically, I created a layout that has max-widths and min-widths specified on the main divs, specifically to deal with a large (desktop) and narrow (mobile) viewports.
The wide desktop layout will fill about 1000px in width of actual content. If I narrow the browser's viewport to half that (to simulate a narrow mobile view), the DIVs gracefully narrow while font size stays the same. In theory, all my bases are covered for 500px upward (it stops at 1000px)
The only problem is that my iPhone and iPad try to accommodate the max-width value of the desktop layout instead of falling back on min-width. Like it's trying to be TOO useful. So what I end up with is a zoomed-out layout that's difficult to read due to tiny font size.
Is there a command I can include somewhere that'll tell mobile devices to treat 500px like 500px, without any zoom compensation to fit to viewport?
In iOS you cannot turn of the user zoom anymore, what Apple says is -
To improve accessibility on websites in Safari, users can now pinch-to-zoom even when a website sets user-scalable=no
in the viewport.
As for getting it to be 1px = 1px, you can only do this by using the correct media-query, complete with using the correct resolution. Get it wrong and the iOS Safari browser, (and every other browser) will automatically make the page fit.
That is why I said it is an almost impossible task. Plus d
...Copy link to clipboard
Copied
If you look in your head content you will see a meta tag with the 'name' viewport, simply delete the device-width property, and change the user-scalable property to "no", (include the quotes").
Be warned though that mobile devices will then display to the nearest media-query, and unless you cover every other device size, the display with all fonts, images, etc. will be smaller, unless you also include a resolution setting in the media-query.
Do you know every device size and resolution, not just your iPhone/iPads?
Copy link to clipboard
Copied
Could you be more literal about what I should be adding or modifying in the source code? I currently have no line there resembling what you're describing.
Also, I don't believe in designing for 100% of the resolutions out there; I believe in a nice compromise. I've got 90% of my demographic covered, don't worry. Still looking to disable that auto-fit thing on mobile, though.
Copy link to clipboard
Copied
<meta name="viewport" content="width=device-width, initial-scale=1">
Copy link to clipboard
Copied
Copy link to clipboard
Copied
That's the line you must remove, it may not be exactly the same, but look for the word viewport.
Copy link to clipboard
Copied
There's no line referencing the viewport anywhere in my code, so why is it still auto-fitting?
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>er site</title>
<link rel="stylesheet" type="text/css"
href="https://fonts.googleapis.com/css?family=Pathway Gothic One|Oswald|Palanquin|Caveat">
<link href="/scripts/site.css" rel="stylesheet" type="text/css" />
</head>
<body>
By default, smart phones will auto-fit.
I want to turn the auto-fitting off so that 1px = 1px.
I don't want it zooming out until the whole site is visible at its widest possible size.
How do I do that?
Copy link to clipboard
Copied
In iOS you cannot turn of the user zoom anymore, what Apple says is -
To improve accessibility on websites in Safari, users can now pinch-to-zoom even when a website sets user-scalable=no
in the viewport.
As for getting it to be 1px = 1px, you can only do this by using the correct media-query, complete with using the correct resolution. Get it wrong and the iOS Safari browser, (and every other browser) will automatically make the page fit.
That is why I said it is an almost impossible task. Plus do not forget that even if you do get 1px to = 1px, the users setting will over ride anything you set for text, (look in the setting).
Copy link to clipboard
Copied
If Apple is overriding everything, then I'm wasting my time. Thanks for the info.
Copy link to clipboard
Copied
Your welcome.
You may be interested to know, that the info about iOS overriding settings was new to me, (and probably almost everyone else) .
Copy link to clipboard
Copied
I post weird threads that almost always accidentally uncover something the experts didn't yet know if they help more people than just me piece stuff together, all the better.
There's an infinity of tutorials out there on how to handle desktop vs mobile, many seem to involve using 2 stylesheets. I have no issues with this solution after learning that Apple is still trying to make the decisions for us. Have they done ANYTHING right since Jobs died?
But I digress. What I'm really asking is if you have a tutorial to recommend that isn't dated 2009 and contains the most recent info available. Whether it uses multiple stylesheets, if/than statements, or something else entirely. Thanks!
Copy link to clipboard
Copied
I haven't seen a tutorial I would recommend on anything to do with front-end web development, since the original iPhone came out.
99.9% is mainly based on someone personal opinion, or on ideas that when looked into are so full of holes one could use them as a colander. Then of course everything changes with every update, (as we just found out ) as with better css support more becomes possible.
It may sound strange, even after almost 10 years of developers trying to find the best strategy for handling responsive sites, but do what you think is best for you. Even if you develop with 2 or more style sheets, you can always move everything to 1 file once you are ready to commit to a live site.
Be careful if you wish to use a pre/post-processor though, as no one type has yet to become what most people use, and browser support for css solutions for things like css variables, has improved dramatically, and more is yet to be implemented. That means the use of pre/post-processors may not be necessary in 4-5 years time.
Copy link to clipboard
Copied
pziecina wrote
In iOS you cannot turn of the user zoom anymore, what Apple says is -
To improve accessibility on websites in Safari, users can now pinch-to-zoom even when a website sets
user-scalable=no
in the viewport.
IMO, a very wise decision. Incidentally, I would never disable user-scalable for any reason. It's the wrong thing to do. I'm nearsighted. If I can't zoom in on my mobile device, it's useless to me. The golden rule in web design is "don't mess with people's browsers." Apple is making certain that we don't. So good for them.
Nancy
Copy link to clipboard
Copied
Having now Googled this to death, I see there's no consensus on the best way to handle being both desktop & mobile friendly. Were it not for the stupid iOS auto-fit issue, I was going to create a liquid layout that plays well single-column for mobile, but also adds stuff if the real estate is there to accommodate it. Except with auto-fit, the space is ALWAYS going to be there. So we end up with microscopic text to fit the largest layout available despite the existence of a Mobile version being ignored. #LeArgh
I've narrowed it down to the 2 most obvious (to me) solutions to the issue :
So... diversity or segregation -- What say you?
Copy link to clipboard
Copied
https://forums.adobe.com/people/Under+S. wrote
So... diversity or segregation -- What say you?
No comment
The problem unfortunately is only going to get worse over the next few years, as more people are starting to browse the internet using smart-tv's (incl. 4k) and 4k game consuls.
Copy link to clipboard
Copied
pziecina wrote
The problem unfortunately is only going to get worse over the next few years, as more people are starting to browse the internet using smart-tv's (incl. 4k) and 4k game consuls.
The auto-zoom will become more popular, I get that. At 4K or anything close to retina display, a 1000 pixel-wide website would occupy barely over 3 inches of width. Who can read that? The internet was built on pixel values. Perhaps that will change to something else now that we're essentially moving into the vector age of no fixed pixels (I even predict a future where your average $600 Nikon/Cannon camera will take vector photos, not just pixel ones, by essentially redrawing everything with ridiculous precision in vector format -- at first, it will be like Polaroids, you'll have to wait a few seconds to see the photo, even on-screen, because billions of calculations -- but I digress).
I've yet to hear a better solution than 2 sets of classes, one for portrait / small screens, and one for landscape / large screens. Web design was never about recreating the same exact experience on all viewports, that's a madman's mission. There is always going to be a "sweet spot" where one specific resolution really puts the website in its best light in the beholder's eye, but seldom will everyone agree on which one that is (some people LIKE artsy, some people prefer straight-forward, and some people like a mix of both).
That being said, which of the 2 methods I'm suggesting is the one you CSS deities prefer, or consider more sound today?
Copy link to clipboard
Copied
I tend to create the css for a specific sized and resolution of screen separately, then combine what I require into one file.
For me trying to navigate around the css for multiple screen sizes and resolutions, simply gets too complicated. Doing it the way I do, I can customize the layout for each type of user much easier. Though it can get complicated merging the css files together, until one knows exactly what one is doing.
Copy link to clipboard
Copied
. . . .diversity or segregation. . .
I use one stylesheet that has media queries at 100px increments between 1200 and 500. If it were not for managing text sizes, I could get by with just two media queries. I use a combination of REMs and VWs for text sizes.
I use flexbox and percentages heavily for site structure, so text sizes is the only real pain.
Below 800px the menu switches to a mobile friendly version.
Copy link to clipboard
Copied
Below 800px the menu switches to a mobile friendly version.
Doesn't retina display screw up even the best laid plans, though? The latest iPhone is 2048 pixels, how does your site know it's mobile when mobile has reached 300dpi before desktop monitors have? My mom's phone has a higher resolution than her desktop flat-screen.
Copy link to clipboard
Copied
Doesn't retina display screw up even the best laid plans, though? The latest iPhone is 2048 pixels, how does your site know it's mobile when mobile has reached 300dpi before desktop monitors have?
Unless I'm missing something, I don't see this as any problem.
The latest generation iPhone & iPad are much wider than previous versions. These so-called hand held devices behave more like laptops and desktops now. All that means is your page will render as intended on laptops. It's no great tragedy, is it?
Nancy
Copy link to clipboard
Copied
https://forums.adobe.com/people/Nancy+OShea wrote
Unless I'm missing something, I don't see this as any problem.
The latest generation iPhone & iPad are much wider than previous versions. These so-called hand held devices behave more like laptops and desktops now. All that means is your page will render as intended on laptops. It's no great tragedy, is it?
Nancy
Speaking only for myself, at equal resolutions (ie, 1000+) I wouldn't throw the same font size at a 300dpi mobile screen as I would a two-digit dpi desktop screen.
Copy link to clipboard
Copied
Are you using Viewport Units?
Viewport Sized Typography | CSS-Tricks
Nancy
Copy link to clipboard
Copied
how does your site know it's mobile. . .
I use a server side script to identify the device. This happens even before the page starts to render, so I can, for instance, not send an image slider with eight large images to a small device.
Such a method is not a replacement for media queries, etc.
. . .and what Nancy said.
Copy link to clipboard
Copied
If you use the srcset attributes for images, you can also use javascript to query which image is being used. This will also tell you if a hi-dpi and/or large display is being used.
Copy link to clipboard
Copied
Interesting notes. If I'm using PHP (mostly includes) does that open other doors that might help me I.D. mobile devices w/out resorting to resolution? Perhaps PHP can help sniff out the fact that it's a mobile device some other way? Like a hidden "I am a mobile device" tag somewhere in its OS? (Yes, I realize I'm hoping against hope, here.) I ask because I'm not really a programmer, I'm a designer who learned as much about programming as they needed along the way.
Also, Bob, could you share your device-identifying script with us?
Find more inspiration, events, and resources on the new Adobe Community
Explore Now