Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 7 of 7
Like Tree3Likes
  • 1 Post By TheGAME1264
  • 2 Post By boilable

Thread: How to css format iphone for both page AND form

  1. #1
    Junior Member
    Join Date
    Jan 2017
    Posts
    3
    Member #
    56009
    Liked
    2 times

    How to css format iphone for both page AND form

    Okay, I'm at my wits end. Signed up for account here cause need help, big time.

    In css, I can use the @media screen and device-aspect-ratio to properly format a horizontal form on a page for desktop, print, droid, horizontal, vertical. We all know how to do that right? It all works great!

    Then along comes the iPhone. The device-aspect-ratio doesn't properly differentiate between the iphone and a larger computer screen. I have to use the simple aspect-ratio, or some other property.

    Here's the problem. The @media chooses either the page or the form. If the user is looking at the page, then it's formatted for the page. As soon as the user clicks on the first field in the form, then it's formatted for the form.

    Thus, if the page is vertical, and the form is horizontal, then the device-aspect-ratio isn't fooled. But the aspect-ratio is fooled.

    Here's the problem with using only aspect-ratio. On pages with a form, when the user clicks the form, the simple aspect-ratio zooms in on the form. So .... if the page is vertical, and the form is horizontal, then the page blows up.


    Here's the problem with using device-aspect-ratio. On iphones, in a vertical orientation, the page isn't properly formatted for an iPhone.

    How can I format the form and the page both for the iPhone, without blowing up the page when the user clicks on the form?

    I don't want to use java script.
    I want to keep the css as clean as possible.

  2.  

  3. #2
    Unpaid WDF Intern TheGAME1264's Avatar
    Join Date
    Dec 2002
    Location
    Not from USA
    Posts
    14,283
    Member #
    425
    Liked
    2719 times
    Have you tried using min and max width instead?
    boilable likes this.
    If I've helped you out in any way, please pay it forward. My wife and I are walking for Autism Speaks. Please donate, and thanks.

    If someone helped you out, be sure to "Like" their post and/or help them in kind. The "Like" link is on the bottom right of each post, beside the "Share" link.

    My stuff (well, some of it): My bowling alley site | Canadian Postal Code Info (beta)

  4. #3
    Senior Member Ronald Roe's Avatar
    Join Date
    Mar 2011
    Location
    Oklahoma City
    Posts
    2,827
    Member #
    27197
    Liked
    867 times
    I'm having a hard time visualizing the problem. Do you have an example online somewhere that we can play with? If you could put it up on a site like Codepen or JSBin, that'd be helpful, since we'll be able to better help troubleshoot.
    Ron Roe
    Web Developer
    "If every app were designed using the same design template, oh wait...Bootstrap."

  5. #4
    Senior Member Ronald Roe's Avatar
    Join Date
    Mar 2011
    Location
    Oklahoma City
    Posts
    2,827
    Member #
    27197
    Liked
    867 times
    On a side note, device-aspect-ratio has been deprecated.

    Also, is there a reason the orientation query won't work? Again, I may be misunderstanding the question.
    Last edited by Ronald Roe; Jan 07th, 2017 at 10:08 AM.
    Ron Roe
    Web Developer
    "If every app were designed using the same design template, oh wait...Bootstrap."

  6. #5
    Junior Member
    Join Date
    Jan 2017
    Posts
    3
    Member #
    56009
    Liked
    2 times
    Quote Originally Posted by TheGAME1264 View Post
    Have you tried using min and max width instead?
    Thanks everyone! Actually, I was able to make this idea work.

    Used max-width of 640 to format for the set of all portrait oriented hand held devices. This would include portrait oriented phones and landscape oriented iphones, etc.

    Used min-width of 641 to format for everything else. This would include wider computer desktop screens and landscape tablets.

    I think that the orientation thing just isn't working out when a page has a form on it. The orientation thing seems to want to work with whatever the user 'sees', like a page, or (when the click on it) a form. If the orientation of the page is different that the form -- my format goes to s-----.

    By concentrating on the available width of pixels, I was able to make it work. It boils down to whether the device has enough pixels in its width to handle *MY* landscape format. If it does, then I give it. If it doesn't, then I don't. Whether the device is in portrait or landscape orientation becomes a non-issue.

    Thanks again.
    Last edited by boilable; Jan 07th, 2017 at 11:42 AM.

  7. #6
    Junior Member
    Join Date
    Jan 2017
    Posts
    3
    Member #
    56009
    Liked
    2 times
    One other point. I guess the thing that caused me trouble, is that apparently I missed that max-width is the max-width of the orientation of device. Not the max-width of the landscape dimension of the device.

    For example: if a 400x600 device is in portrait orientation, then max-width would be 400px. It would not be 600px. If in landscape, then it would be 600px.

    You all probably know this. I missed it somewhere along the line. LoL.
    TheGAME1264 and Ronald Roe like this.

  8. #7
    Unpaid WDF Intern TheGAME1264's Avatar
    Join Date
    Dec 2002
    Location
    Not from USA
    Posts
    14,283
    Member #
    425
    Liked
    2719 times
    At least you learned. And now you know. And knowing is half the battle.

    If I've helped you out in any way, please pay it forward. My wife and I are walking for Autism Speaks. Please donate, and thanks.

    If someone helped you out, be sure to "Like" their post and/or help them in kind. The "Like" link is on the bottom right of each post, beside the "Share" link.

    My stuff (well, some of it): My bowling alley site | Canadian Postal Code Info (beta)


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 03:53 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com