Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mobile Safari on iPhone/iPod CSS hack

Does anyone know a good modern CSS hack to target only mobile safari on iPhone and iPod Touch?

I keep seeing @media screen and (max-device-width: 480px), but that's from 3 years ago and matches Nexus S among others now.

(This is to fix a subtle layout issue. I realise browser sniffing is evil etc.)

like image 438
mahemoff Avatar asked Jul 13 '12 12:07

mahemoff


People also ask

Is there a way to enable Safari on iOS devices?

As a commenter pointed out, there are other options to choose from: Go to Supported CSS Properties and search for "Safari on iOS". Show activity on this post. As mentioned above, the short answer is no.

Is Apple’s website design for iPhone X a hack?

Not me. Apple is using the CSS standards as intended; perhaps you should read their blog post before you decide it’s a hack: Designing Websites for iPhone X. Here’s the code:

Is Apple using the CSS standards to design websites for iPhone?

Apple is using the CSS standards as intended; perhaps you should read their blog post before you decide it’s a hack: Designing Websites for iPhone X. Here’s the code: @supports(padding: max(0px)) { .post { padding-left: max(12px, constant(safe-area-inset-left)); padding-right: max(12px, constant(safe-area-inset-right)); } }

Is Safari the only browser that can run on iOS?

Since Safari is the only browser than can run natively on iOS, other mobile browsers are a none-issue. Firefox and Chrome for iOS use WebKit under the hood, so they already support the new stuff. I suspect Chrome for Android will add support if or when Google ships a device that could benefit from them. Steve Tegtmejer


1 Answers

http://cssuseragent.org and welcome to the Dark Side.

like image 183
Martin Kool Avatar answered Dec 01 '22 05:12

Martin Kool