Your CSS reset needs text-size-adjust (probably)

Kilian Valkhof:

[…] Mobile Safari increases the default font-size when you switch a website from portrait to landscape. On phones that is, it doesn’t do it on iPad. Safari has been doing this for a long time, as a


Your CSS reset needs text-size-adjust (probably) originally published on CSS-Tricks. You should get the newsletter and become a supporter.


This content originally appeared on CSS-Tricks and was authored by Chris Coyier

Kilian Valkhof:

[…] Mobile Safari increases the default font-size when you switch a website from portrait to landscape. On phones that is, it doesn’t do it on iPad. Safari has been doing this for a long time, as a way to improve readability on non-mobile optimized websites. While undoubtedly useful in a time when literally no website was optimized for mobile, it’s significantly less helpful nowadays. […] Text size increasing randomly in a single situation is exactly the type of thing you want to guard for with a CSS reset.

This is very literally what text-size-adjust does. MDN:

When an element containing text uses 100% of the screen’s width, the algorithm increases its text size, but without modifying the layout. The text-size-adjust property allows web authors to disable or modify this behavior, as web pages designed with small screens in mind do not need it.

You can see Apple’s own docs showing off this is exactly what they do (on iPhones). There is an ancient bug where this would prevent zooming, but probably not a huge concern anymore.

Kilian’s recommendation:

html {
  -moz-text-size-adjust: none;
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
}

Firefox doesn’t even support it, so I’d maybe lose that vendor prefix, but otherwise I’d say I’m on board. I’d like to think I can handle my own text sizing.

Reminds me of how Mobile Safari does that zooming thing with text inputs under 16px, so watch out for that too.

To Shared LinkPermalink on CSS-Tricks


Your CSS reset needs text-size-adjust (probably) originally published on CSS-Tricks. You should get the newsletter and become a supporter.


This content originally appeared on CSS-Tricks and was authored by Chris Coyier


Print Share Comment Cite Upload Translate Updates
APA

Chris Coyier | Sciencx (2022-02-12T00:46:40+00:00) Your CSS reset needs text-size-adjust (probably). Retrieved from https://www.scien.cx/2022/02/12/your-css-reset-needs-text-size-adjust-probably-2/

MLA
" » Your CSS reset needs text-size-adjust (probably)." Chris Coyier | Sciencx - Saturday February 12, 2022, https://www.scien.cx/2022/02/12/your-css-reset-needs-text-size-adjust-probably-2/
HARVARD
Chris Coyier | Sciencx Saturday February 12, 2022 » Your CSS reset needs text-size-adjust (probably)., viewed ,<https://www.scien.cx/2022/02/12/your-css-reset-needs-text-size-adjust-probably-2/>
VANCOUVER
Chris Coyier | Sciencx - » Your CSS reset needs text-size-adjust (probably). [Internet]. [Accessed ]. Available from: https://www.scien.cx/2022/02/12/your-css-reset-needs-text-size-adjust-probably-2/
CHICAGO
" » Your CSS reset needs text-size-adjust (probably)." Chris Coyier | Sciencx - Accessed . https://www.scien.cx/2022/02/12/your-css-reset-needs-text-size-adjust-probably-2/
IEEE
" » Your CSS reset needs text-size-adjust (probably)." Chris Coyier | Sciencx [Online]. Available: https://www.scien.cx/2022/02/12/your-css-reset-needs-text-size-adjust-probably-2/. [Accessed: ]
rf:citation
» Your CSS reset needs text-size-adjust (probably) | Chris Coyier | Sciencx | https://www.scien.cx/2022/02/12/your-css-reset-needs-text-size-adjust-probably-2/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.