-
Notifications
You must be signed in to change notification settings - Fork 23.2k
40776 text autospace #40912
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
40776 text autospace #40912
Changes from 33 commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
4572884
created the text-autospace page
dletorey 4e9a8b8
Merge branch 'main' into 40776-text-autospace
dletorey 791a055
added text-autospace to css text page
dletorey ae753b6
added text-autospace to see also of text-spacing-trim
dletorey 8181ac8
updated see also and added values
dletorey 275a7c7
added values definitions and example
dletorey 1ff66ec
Merge branch 'main' into 40776-text-autospace
dletorey 725962f
Update files/en-us/web/css/text-autospace/index.md
dletorey 66f32dc
Update files/en-us/web/css/text-autospace/index.md
dletorey b1ad5c5
Update files/en-us/web/css/text-autospace/index.md
dletorey 0135386
Update files/en-us/web/css/text-autospace/index.md
dletorey 7a57ecc
Update files/en-us/web/css/text-spacing-trim/index.md
dletorey 5c81802
Update files/en-us/web/css/text-autospace/index.md
dletorey ff88bc3
Merge branch 'main' into 40776-text-autospace
dletorey 18bd0be
removed experimental inline macro
dletorey 4256784
added <autospace> and reordered autospace values
dletorey aecea23
Update files/en-us/web/css/text-autospace/index.md
dletorey 0bb2d94
Update files/en-us/web/css/text-autospace/index.md
dletorey e26fc1f
Update files/en-us/web/css/text-autospace/index.md
dletorey 4cfb30b
Update files/en-us/web/css/text-autospace/index.md
dletorey c3e08cf
Update files/en-us/web/css/text-autospace/index.md
dletorey 462126d
Update files/en-us/web/css/text-autospace/index.md
dletorey ba2b64d
Update files/en-us/web/css/text-autospace/index.md
dletorey 8525211
Update files/en-us/web/css/text-autospace/index.md
dletorey 4420187
Update files/en-us/web/css/text-autospace/index.md
dletorey c176770
Merge branch '40776-text-autospace' of github.com:dletorey/content in…
dletorey c4c3a29
updated the html code block
dletorey d3af24f
reordered syntax to match the spec and added extra syntax options for…
dletorey 0beee61
added note about insert
dletorey 64103db
Merge branch 'main' into 40776-text-autospace
dletorey dbceebd
Merge branch 'main' into 40776-text-autospace
dletorey 876c31a
updated the description of no-autospace value
dletorey c3ba46e
Merge branch '40776-text-autospace' of github.com:dletorey/content in…
dletorey 39066ed
Update files/en-us/web/css/text-autospace/index.md
dletorey 9f57164
Merge branch 'main' into 40776-text-autospace
dletorey d1da269
added indentation for values and corrected the syntax examples
dletorey File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,182 @@ | ||
| --- | ||
| title: text-autospace | ||
| slug: Web/CSS/text-autospace | ||
| page-type: css-property | ||
| browser-compat: css.properties.text-autospace | ||
| sidebar: cssref | ||
| --- | ||
|
|
||
| The **`text-autospace`** [CSS](/en-US/docs/Web/CSS) property allows you to specify the space applied between Chinese/Japanese/Korean (CJK) and non-CJK characters. | ||
|
|
||
| ## Syntax | ||
|
|
||
| ```css | ||
| 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 insert; | ||
| text-autospace: ideograph-alpha replace; | ||
| text-autospace: ideograph-numeric insert; | ||
| text-autospace: ideograph-numeric replace; | ||
| text-autospace: punctuation insert; | ||
| text-autospace: punctuation replace; | ||
| text-autospace: auto; | ||
|
dletorey marked this conversation as resolved.
|
||
|
|
||
| /* Global values */ | ||
| text-autospace: inherit; | ||
| text-autospace: initial; | ||
| text-autospace: revert; | ||
| text-autospace: revert-layer; | ||
| text-autospace: unset; | ||
| ``` | ||
|
|
||
| ### Values | ||
|
dletorey marked this conversation as resolved.
|
||
|
|
||
| - `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`](#ideograph-alpha) and [`ideograph-numeric`](#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` | ||
|
dletorey marked this conversation as resolved.
Outdated
|
||
| - : 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` | ||
| - : Creates extra non-breaking spacing around punctuation as required by language-specific typographic conventions. | ||
|
dletorey marked this conversation as resolved.
Outdated
|
||
| - `insert` | ||
| - : If there are no spaces between the _ideograph_ and _non-ideographic_ scripts the user agent automatically inserts the correct spacing. | ||
| - `replace` | ||
| - : If there are spaces between the _ideograph_ and _non-ideographic_ scripts, such as [U+0020](/en-US/docs/Glossary/Whitespace), the user agent automatically replaces it with the correct spacing. | ||
|
dletorey marked this conversation as resolved.
Outdated
|
||
| - `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 {{CSSXRef("word-spacing")}} and {{CSSXRef("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 | ||
|
|
||
| {{CSSInfo}} | ||
|
|
||
| ## Formal syntax | ||
|
|
||
| {{csssyntax}} | ||
|
|
||
| ## 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. | ||
|
|
||
| ```html hidden | ||
| <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> | ||
| ``` | ||
|
|
||
| ```html | ||
| <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> | ||
| ``` | ||
|
|
||
| ```css | ||
| .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; | ||
| } | ||
| ``` | ||
|
|
||
| ```css hidden | ||
| 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; | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ```js hidden | ||
| 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 | ||
|
|
||
| {{Specifications}} | ||
|
|
||
| ## Browser compatibility | ||
|
|
||
| {{Compat}} | ||
|
|
||
| ## See also | ||
|
|
||
| - {{cssxref('text-spacing-trim')}} | ||
| - [`ic`](/en-US/docs/Web/CSS/CSS_Values_and_Units/Numeric_data_types#local_font-relative_lengths) and [`ric`](/en-US/docs/Web/CSS/CSS_Values_and_Units/Numeric_data_types#root_font-relative_lengths) units | ||
| - [CSS Text](/en-US/docs/Web/CSS/CSS_text) module | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.