files/en-us/web/css/reference/properties/text-autospace/index.md
The text-autospace CSS property allows you to specify the space applied between Chinese/Japanese/Korean (CJK) and non-CJK characters.
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;
normal
ideograph-alpha and ideograph-numeric.<autospace>
no-autospace, or a combination of one or more of ideograph-alpha, ideograph-numeric, and punctuation, optionally followed by insert or replace.
no-autospace
ideograph-alpha
ideograph-numeric
punctuation
insert
replace
auto
[!NOTE] If neither
insertnorreplaceare specified, the behavior is the same asinsert.
[!NOTE] This property is additive with the {{CSSXRef("word-spacing")}} and {{CSSXRef("letter-spacing")}} properties. The amount of spacing contributed by the
letter-spacingsetting is added to the spacing created bytext-autospace. The same applies toword-spacing.
{{CSSInfo}}
{{csssyntax}}
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;
});
{{EmbedLiveSample("Example", 200, 200)}}
{{Specifications}}
{{Compat}}