Replies

Jul 11, 2017 8 years ago Official
Bug
User Avatar
Segfault

Quote by BoaConstrictor
Is there a way to put the Training Center back to its old size?</p>
<p>Actually it&;s really bad on mobile, because even more scrolling - sideways. But that has to be taken the way it is now, anyway :-(
This decision was sort of a compromise in favor of what seemed most popular/wanted by users. Unfortunately, Subeta's current layout simply isn't mobile responsive. I can't make the page look one way for you but a different way for desktop users. I'm struggling with how to explain why this is, but I'll do my best.

To give a simplified explanation: designing for mobile is weird because 1 pixel on the device screen might not be equal to 1 pixel in the CSS.

For instance, here I have Subeta's "mobile" layout open in an iPhone 6 emulator:

You can see that the size of the screen here is 667 x 375. (It's written at the top.) However, if I inspect the webpage to find the size of the elements on the page:

Ignore the height - it's large because the page scrolls - but note that the width is 1000px, rather than the 667px you'd expect. That's the width of that element. That's how wide the webpage thinks the screen is, and all of the calculations done on that webpage use that size.

So basically, the webpage might know if you're on a phone or a computer, but it doesn't know the actual size of whatever screen you're on. In this case, the webpage can't make accurate calculations to make it look nice on mobile, because it doesn't know that the device is actually 667 x 375.

To get around this, you need to have a specific line of code that gets the actual size of the screen/device for your CSS to work with. Otherwise, the website will be rendered essentially the same on mobile and desktop devices - which is what's happening on Subeta right now, because Subeta's current layout is missing this line. I've tried to simply add it in, but adding it actually causes more things to break since so much of the site was coded without it.

more technical stuff in here If you're curious, I'm talking about the viewport meta tag, which goes in the HTML head and is used to control the viewport. You can read more about it on this page under the title "Setting the Viewport".

Without this line, not only will small tricks like min-width not work, but media queries can also get really confused. This article on the topic gives a more in-depth explanation, here's a relevant quote:

Quote
For example, let’s take the iPhone 4, which has a 980px width default viewport. Without the meta tag in place, your attempt at media queries would go horribly wrong and it would incorrectly reference the default viewport. Most mobile media queries target around 500px or under. This is usually accomplished by a simple max-width media query. Without the meta tag, you wouldn’t see this query take effect, since the iPhone 4 would still be displaying the 980px width version of your website.
And yes, that means libraries like Bootstrap, which are meant to simplify designing around mobile, will also be thrown off without this line.

🐝 ☕ bug (he/him) | your friendly neighborhood code wrangler. stay in the loop! join and check out the latest admin post highlights

Please log in to reply to this topic.