This is an experimental technology
Because this technology's specification has not stabilized, check the compatibility table for the proper prefixes to use in various browsers. Also note that the syntax and behavior of an experimental technology is subject to change in future versions of browsers as the spec changes.
On mobile devices, the
text-size-adjust CSS property allows Web authors to control if and how the text-inflating algorithm is applied to the textual content of the element it is applied to.
As this property is non-standard, it must be used prefixed:
Browsers on smartphones don't display web pages using the same algorithms as browsers rendering web pages on desktop machines. Instead of laying out the web page at the width of the device screen, they lay it out using a viewport that is much wider than the device screen, usually of 800 or 1000 pixels wide. One of two possible methods is used to map back to the original device coordinates: either a smaller window is then used to display on the device screen only part of what is actually being rendered, or the viewport is stretched to the size of the device.
In essence, this means that either only a small, rectangular portion of the original web page is usually visible on a mobile device screen or that on mobile devices, the web page looks "zoomed out" and smaller than intended.
This approach has been used as numerous web sites are not able to cope with small screens and are not usable when using the classical layout algorithm. This technique has drawbacks: the text is so tiny that it is unreadable without zooming. Even so, the user experience is better with the classical approach, which often leads to put secondary content at the top of the smartphone display, effectively pushing the main content of the page outside the viewport.
But when the user zoomed in until the text becomes readable, an horizontal scrollbar is often needed as the line becomes larger than the width of the screen. This horizontal scrollbar has to be used to read each line of the text, which is a user experience nightmare. To prevent this, several mobile browsers implement a text inflation algorithm. When a focused element containing text use 100 % of the width of the screen, its text size is increased until it reached a readable size, without modifying the layout and removing the need of an horizontal scrollbar.
text-size-adjust property allows Web authors to opt out from this behavior, as Web pages designed to handle small screen widths do not need it.
- This property is not standard. In order to use it, Web authors have to duplicate, or even triplicate it, prefixed for each engine supporting it.
- Its behavior, and even the syntax, is slightly different from one browser engine to the other. Web developers should read the browser compatibility section with the required attention.
- This property only has an effect on smartphones. As there is no inflation algorithm on desktop browsers, and on some tablet browsers like the iPad, the property is not supported there (and ignored). This property is only designed to opt out, or to cancel this opt-out, of the inflating behavior, not to opt in.
-webkit-text-size-adjustis explicitly set to
none, Webkit-based desktop and tablet browsers, like Chrome or Safari, instead of ignoring the property, will prevent the user to zoom in or out the Web page.#
- Not all engines do allow to control the final size of the text using a percentage value (E.g. Webkit and Trident do allow it, Gecko doesn't). Again Web developers should read the browser compatibility section with the required attention.
- Initial value
autofor smartphone browsers supporting inflation,
nonein other cases (and then not modifiable)
- Applies to all elements
<percentage>yes, refer to the corresponding size of the text font
- Computed value the keyword or the percentage value
- Animatable no
Formal syntax: none | auto | <percentage>
text-size-adjust: none /* text is never inflated */ text-size-adjust: auto /* text may be inflated */ text-size-adjust: <percentage> /* text may be inflated of this exact proportion */ text-size-adjust: inherit
- Is a keyword preventing the usage of the inflation algorithm on the element. Basically, this means that the element will be displayed without its font inflated. On desktop Webkit-based browsers, this will only prevent any zoom on the whole page.
- Is a keyword allowing the usage of the inflation algorithm on the element. Browsers are not forced to use it and they won't do it on desktops and on some tablets. Its main use is to cancel a
nonevalue previously set.
- A percentage value is a synonym of the
autokeyword, with the additional information that the percentage value is the increase rate to be applied to the font size when the inflation algorithm is applied.
text-size-adjust CSS property is on the standard track with this specification.
Only mobile browsers support this CSS property.
|Feature||Chrome||Firefox (Gecko)||Internet Explorer||Opera||Safari (WebKit)|
|Basic support||Not supported (see Webkit note)||Not supported||Not supported||Not supported||Not supported (see Webkit note)|
|Percentages||Not supported||Not supported||Not supported||Not supported||Not supported|
|Feature||Android||Firefox Mobile (Gecko)||IE Phone||Opera Mobile||Safari Mobile|
|Basic support||?||11.0 (11.0) -moz#||(Yes) -ms(see note)
|Percentages||?||Not supported||(Yes)(see note)||Not supported||(Yes)|
IE Phone note
If the viewport is set using
<meta> element, the value of the CSS
text-size-adjust property is ignored.
There is a bug in Webkit-based desktop browsers. If
-webkit-text-size-adjust is explicitly set to
none, Webkit-based desktop browsers, like Chrome or Safari, instead of ignoring the property, will prevent the user to zoom in or out the Web page. See Bug 56543, Bug 163359, and Bug 84186.