Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPhone website version, recommend working in px or in %?

Tags:

css

width

iphone

I haven't done any iPhone version yet, so I have this question,

In order to be able to browse the website properly -even if the user turns 90º his phone:

enter image description here

Shall i CSS set with's in px or in % ?

like image 814
Toni Michel Caubet Avatar asked Aug 24 '11 08:08

Toni Michel Caubet


People also ask

What are the built-in security and privacy features on the iPhone?

Built-in security features help prevent anyone but you from accessing the data on your iPhone and in iCloud. Built-in privacy features minimize how much of your information is available to anyone but you, and you can adjust what information is shared and where you share it.

Which iPhone should you buy right now?

The iPhone XS Max is the best iPhone you can buy right now. It's Apple's biggest and best iPhone – if your hands and wallets are large enough. It has an expansive 6.5-inch OLED screen with HDR10 support to make colors pop. It's the perfect phone if you want a giant screen.

How does Safari work on the new iPhone X?

Out of the box, Safari displays your existing websites beautifully on the edge-to-edge display of the new iPhone X. Content is automatically inset within the display’s safe area so it is not obscured by the rounded corners, or the device’s sensor housing. The inset area is filled with the page’s background-color...

Should you buy an older or newer iPhone?

Apple keeps its phones updated for years, so they remain viable for a long time, and if you're looking to save money then an older iPhone might be a great choice for you. With Apple's phones typically being expensive, cost is one of the main things to consider when buying.


1 Answers

If you are programatically targeting the iOS devices such as the iPhone & iTouch then i would use pixels opposed to percentages, but if you are not targeting such devices and want a one stop mobile website for all (most smart-phones) then i would consider using percentages.

you can specificy min-width max-width and min-device-width and max-device-width in your media queries.

Here is a little more about media queries and the combinations that you can do;

/* Target iPhone Portrait */
@media screen and (max-width: 320px) and (orientation: portrait) { body{background:#F0F;} }

/* Target Android Portrait larger than 320px Width */
@media screen and (min-width: 321px) and (max-width: 480px) and (orientation: portrait) { body{background:#F00;} }

/* Target iPhone Landscape */
@media screen and (max-width: 480px) and (orientation: landscape) { body{background:#0F0;} }

/* Target Android Landscape */
@media screen and (min-width: 481px) and (max-width: 800px) and (orientation: landscape) { body{background:#FF0;} }
like image 62
Xavier Avatar answered Oct 07 '22 13:10

Xavier