<pre class="metadata">
Title: CSS Mobile Text Size Adjustment Module Level 1
Status: ED
Work Status: Revising
Shortname: css-size-adjust
Group: csswg
Level: 1
TR: https://www.w3.org/TR/css-size-adjust/
ED: https://drafts.csswg.org/css-size-adjust/
Editor: L. David Baron, Google https://www.google.com/, https://dbaron.org/, w3cid 15393
Editor: Tantek &Ccedil;elik, Mozilla https://www.mozilla.org/, http://tantek.com/, w3cid 1464
Abstract: This module contains features of CSS relating to one possible mechanism for adapting pages designed for desktop computer displays for display on smaller screens such as those of mobile phones.  This mechanism involves displaying a scaled down display of the Web page and allowing the user to pan and zoom within that display, but within that scaled down display making certain text and similar elements larger than specified by the page author in order to ensure that when a block of wrapped text is zoomed to the width of the device (so it can be read without side-to-side scrolling for each line), the text is large enough to be readable.
Status Text: <p>The following features are at risk:</p> <ul> <li>the reference to [[!CSS-TEXT-4]]&apos;s 'text-wrap' property</li> </ul>
</pre>

<pre class="link-defaults">
spec: css-text-4; type: property; text: text-wrap
</pre>

Introduction {#intro}
=====================

  A common mechanism for displaying Web pages that were designed for
  large desktop displays on much smaller displays such as those of
  mobile phones involves allowing the user to pan and zoom around within
  a view of the Web page drawn as though it were drawn into the width of
  a typical desktop Web browser display.  The ability to pan and zoom
  the page lets the user both see an overview of the page and zoom in to
  specific parts to read or interact with them.

  One common problem with this type of interaction occurs when the
  user wants to read a large block of text.  It might be that a block of
  text within this desktop-formatted page might be laid out so that when
  the user zooms in so that the text is large enough to read, each line
  of text is wider than the display on the small device.  This means the
  user needs to scroll side to side to read <em>each line of text</em>,
  which is a serious inconvenience to the user.

  One way for software that displays Web pages or other CSS-formatted
  content on a mobile device is to make some of the text larger so that
  this problem does not occur.  The goal of this enlargement is to make
  the text big enough so that when the block it is in is scaled to the
  width of the display, the text is large enough to read.  At the same
  time, this needs to be done with minimal disruption to the overall
  design of the page.

  While implementations of CSS are not required to use this
  technique, this module describes how implementations of CSS that do
  use this technique must do so.
  In other words, while implementations of CSS are not required to
  implement this module, this module nonetheless places requirements on
  implementations of this module.

  This module describes how this size adjustment works and describes a
  new CSS property that authors of CSS can use to provide hints to the
  implementation about which text or other elements should or should not
  be enlarged.

Module interactions {#placement}
--------------------------------

  This module adds additional features that are not defined in
  [[CSS2]].  These features may lead to a different size being computed
  than would be computed when following [[CSS2]] alone.

Value Definitions {#values}
-----------------

  This specification follows the <a href="https://www.w3.org/TR/CSS2/about.html#property-defs">CSS property definition conventions</a> from [[!CSS21]]
  using the <a href="https://www.w3.org/TR/css-values-3/#value-defs">value definition syntax</a> from [[!CSS-VALUES-3]].
  Value types not defined in this specification are defined in CSS Values &amp; Units [[!CSS-VALUES-3]].
  Combination with other CSS modules may expand the definitions of these value types.

  In addition to the property-specific values listed in their definitions,
  all properties defined in this specification
  also accept the <a>CSS-wide keywords</a> as their property value.
  For readability they have not been repeated explicitly.

Default size adjustment {#default-adjustment}
=============================================

This section defines the default size adjustment rules.  These rules
are then referenced by the definition of the 'text-size-adjust' property
in the following section.

Issue: All of the subsections of this section need significant
refinement:  additional detail, verification that the detail already
present is correct, etc.

Issue: It's not clear how much this section should define
precise behavior versus how much it should allow future room for
innovation and improvement.

Types of boxes adjusted {#default-adjustment-types}
---------------------------------------------------

The default size adjustment affects text and form controls, whether
those form controls contain text (e.g., text inputs, selects) or do not
(e.g., radio buttons, checkboxes).

Conditions that suppress adjustment {#default-adjustment-conditions}
--------------------------------------------------------------------

A number of conditions suppress the default adjustment because these
conditions are associated with layouts for which the user experience
would be worsened by size adjustment rather than improved by it.  These
conditions are:

<ul>
  <li>when the total amount of text in the block formatting context (see
  [[!CSS2]]) (excluding text inside descendant block formatting
  contexts) is approximately smaller than the amount that would require
  wrapping to more than one or two lines within that context's
  width,</li>

  <li>when the objects to be adjusted are inside a block-level or
  ''display: inline-block'' element with a 'height' other than
  ''height/auto'' (see [[!CSS2]]),</li>

  <li>when the objects to be adjusted are inside a
  ''display: inline-block'' element
  with a 'width' other than ''width/auto'' (see
  [[!CSS2]]),</li>

  <li>when the objects to be adjusted have 'white-space' of ''white-space/pre'' or
  ''white-space/nowrap'' (see [[!CSS2]]) or a 'text-wrap' of ''text-wrap/nowrap'' (see
  [[!CSS-TEXT-4]]).</li>

</ul>

Calculation of default adjustment {#default-adjustment-calculation}
-------------------------------------------------------------------

The adjustment performed should be based on preferences (of the
renderer or the renderer's user) indicating the desired <dfn export>minimum readable text size</dfn>.
Given this preference, for each containing block of text to be adjusted,
there is a <dfn export>minimum block text size</dfn>:  the preference for the
minimum readable text size, times the width of the containing block,
divided by the width of the device.

The size adjustment involves multiplication of sizes by a ratio
determined by the <a>minimum block text size</a> and the computed value of
'font-size'.  This ratio must be at least the first divided by the
second; however, in order to maintain differentiations between font
sizes, it should often be slightly larger.  <span class="issue">Define
this with more detail/precision.</span>


Size adjustment control: the 'text-size-adjust' property {#adjustment-control}
==============================================================================

  <pre class=propdef>
      Name: text-size-adjust
      Value: auto | none | <<percentage [0,∞]>>
      Initial: auto
      Applies to: all elements
      Inherited: yes
      Percentages: see below
      Computed value: specified keyword or percentage
      Animation type: by computed value
      Canonical order: N/A
  </pre>

  <dl dfn-for="text-size-adjust" dfn-type="value">
    <dt><dfn>auto</dfn></dt>
      <dd>Renderers must use the <a href="#default-adjustment">default size adjustment</a> when displaying on a small device.</dd>
    <dt><dfn>none</dfn></dt>
      <dd>Renderers must not do size adjustment when displaying on a small device.</dd>
    <dt><dfn>&lt;percentage [0,∞]&gt;</dfn></dt>
      <dd>When displaying on a small device, renderers must not do size adjustment but instead the computed value of 'font-size' must be multiplied by this percentage.
      <p class="note">Note: This means that 'text-size-adjust: 100%;' is equivalent to 'text-size-adjust: none;'.</p>
      <p>Negative values are invalid.
  </dl>

  Issue: "Small device" is not well defined. We should clearly specify
  when text size adjustment should apply. For example, in practice a
  large tablet is considered by vendors to be a small device.

Acknowledgments {#acknowledgments}
==================================

  The editors would like to thank:
  .

<h2 class=no-num id=privacy>Privacy Considerations</h2>

No new privacy considerations have been reported on this specification.

<h2 class=no-num id=security>Security Considerations</h2>

No new security considerations have been reported on this specification.