Spec-Zone.ru › CSS

`text-autospace` CSS property

Baseline Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

The text-autospace CSS property allows you to specify the space applied between Chinese/Japanese/Korean (CJK) and non-CJK characters.

Syntax

text-autospace: normal;
text-autospace: no-autospace;
text-autospace: ideograph-alpha;
text-autospace: ideograph-numeric;
text-autospace: punctuation;
text-autospace: insert;
text-autospace: replace;
text-autospace: ideograph-alpha ideograph-numeric punctuation;
text-autospace: ideograph-alpha ideograph-numeric;
text-autospace: ideograph-alpha ideograph-numeric insert;
text-autospace: auto;

/* Global values */
text-autospace: inherit;
text-autospace: initial;
text-autospace: revert;
text-autospace: revert-layer;
text-autospace: unset;

Values

normal
Creates the default behavior to automatically apply spacing between CJK and non-CJK characters and around punctuation. This value has the same effect as applying both ideograph-alpha and ideograph-numeric.
<autospace>
Provides more control over spacing behaviors. It accepts the keyword no-autospace, or a combination of one or more of ideograph-alpha, ideograph-numeric, and punctuation, optionally followed by insert or replace.
no-autospace
Disables automatic spacing between CJK and non-CJK characters.
ideograph-alpha
Adds spacing only between ideographic characters (such as Katakana and Han) and non-ideographic letters (such as Latin). It does not add spacing between ideographic characters and non-ideographic numbers.
ideograph-numeric
Adds spacing only between ideographic characters (such as Katakana and Han) and non-ideographic numbers (such as Latin). It does not add spacing between ideographic characters and non-ideographic letters.
punctuation
Adds non-breaking spacing around punctuation as required by language-specific typographic conventions.
insert
Adds the specified spacing only if there are no existing spaces between the ideographic and non-ideographic scripts.
replace
Replaces existing spacing (such as U+0020) between ideographic and non-ideographic characters with the specified spacing.
auto
Lets the browser choose typographically appropriate spacing. The spacing may vary across browsers and platforms.

Note: If neither insert nor replace are specified, the behavior is the same as insert.

Note: This property is additive with the word-spacing and letter-spacing properties. The amount of spacing contributed by the letter-spacing setting is added to the spacing created by text-autospace. The same applies to word-spacing.

Formal definition

Initial value normal
Applies to text elements
Inherited yes
Computed value as specified
Animation type discrete

Formal syntax

text-autospace = 
  normal |
  <autospace> |
  auto

Examples

This example shows the difference between various values of text-autospace. Try selecting a value from the drop-down box to see how it affects the spacing in the text.

<form>
  <label for="autospace">Choose value for <code>text-autospace:</code></label>
  <select name="autospace" id="autospace">
    <option selected value="no-autospace">no-autospace</option>
    <option value="normal">normal</option>
    <option value="ideograph-alpha">ideograph-alpha</option>
    <option value="ideograph-numeric">ideograph-numeric</option>
  </select>
</form>
<div class="unsupported">
  <code>text-autospace</code> is not supported in your browser.
</div>
<main>
  <figure class="no-autospace">
    <figcaption>
      <code>
        text-autospace: <span id="autospace-value">no-autospace</span>;
      </code>
    </figcaption>
    <div>
      <p>HTML超文本标记语言</p>
      <p>42四十二</p>
    </div>
  </figure>
</main>
.no-autospace {
  text-autospace: no-autospace;
}
.auto {
  text-autospace: auto;
}
.normal {
  text-autospace: normal;
}
.ideograph-alpha {
  text-autospace: ideograph-alpha;
}
.ideograph-numeric {
  text-autospace: ideograph-numeric;
}
figure {
  margin: 1rem;
  div {
    font-size: 2rem;
    padding: 1rem;
    font-family: sans-serif;
    border: tomato solid 1px;
  }
  p {
    margin: 0;
  }
}
main {
  max-width: max-content;
}
@supports not (text-autospace: normal) {
  form {
    display: none;
  }
  .unsupported {
    color: red;
  }
}
@supports (text-autospace: normal) {
  .unsupported {
    display: none;
  }
}
const chose = document.querySelector("#autospace");
const fig = document.querySelector("figure");
const codeValue = document.querySelector("#autospace-value");
chose.addEventListener("change", (e) => {
  fig.className = e.target.value;
  codeValue.innerText = e.target.value;
});

Specifications

Specification
CSS Text Module Level 4
# propdef-text-autospace

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Opera Safari Chrome Android Firefox for Android Opera Android Safari on iOS Samsung Internet WebView Android WebView on iOS
text-autospace
140The initial value is no-autospace instead of normal (see csswg-drafts issue #12386).
140The initial value is no-autospace instead of normal (see csswg-drafts issue #12386).
145The initial value is no-autospace instead of normal (see csswg-drafts issue #12386).
124The initial value is no-autospace instead of normal (see csswg-drafts issue #12386).
18.4The initial value is no-autospace instead of normal (see csswg-drafts issue #12386).
140The initial value is no-autospace instead of normal (see csswg-drafts issue #12386).
145The initial value is no-autospace instead of normal (see csswg-drafts issue #12386).
92The initial value is no-autospace instead of normal (see csswg-drafts issue #12386).
18.4The initial value is no-autospace instead of normal (see csswg-drafts issue #12386).
30.0The initial value is no-autospace instead of normal (see csswg-drafts issue #12386).
140The initial value is no-autospace instead of normal (see csswg-drafts issue #12386).
18.4The initial value is no-autospace instead of normal (see csswg-drafts issue #12386).
auto
No
No
145
No
18.4
No
145
No
18.4
No
No
18.4
ideograph-alpha
No
No
145
No
18.4
No
145
No
18.4
No
No
18.4
ideograph-numeric
No
No
145
No
18.4
No
145
No
18.4
No
No
18.4
insert
No
No
145
No
27
No
145
No
27
No
No
27
no-autospace
140
140
145
124
18.4
140
145
92
18.4
30.0
140
18.4
normal
140
140
145
124
18.4
140
145
92
18.4
30.0
140
18.4
punctuation
No
No
No
No
No
No
No
No
No
No
No
No
replace
No
No
No
No
No
No
No
No
No
No
No
No

See also

  • text-spacing-trim
  • ic and ric units
  • CSS Text module

© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/text-autospace

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API