New CSS Hacks to Target Safari

Posted on Category: Misc
Cerfs from L'animal dans la décoration (1897) illustrated by Maurice Pillard Verneuil. Original from the The New York Public Library. Digitally enhanced by rawpixel.

While trying to create a new scalable way to support Dynamic Type on iOS devices, I ran into a snag where it also affected Desktop Safari font sizes. After playing around, I came up with what I believe to be new Safari and iOS CSS targeting hacks.

/* iOS browsers */
@supports(font:-apple-system-body) and (-webkit-touch-callout:default){}
 
/* Desktop Safari */
@supports(font:-apple-system-body) and (not(-webkit-touch-callout:default)){}

Hope this helps.

My opinions & views expressed may not reflect my employer's.


Add a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.