-
Notifications
You must be signed in to change notification settings - Fork 706
Добавляет доку про свойства ruby-align, ruby-position, ruby-overhang
#5849
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
Open
DrakesBot12
wants to merge
27
commits into
doka-guide:main
Choose a base branch
from
DrakesBot12:css/ruby-align-position-overhang
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 5 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
9a6d0bf
Добавляю доку про свойства ruby-align, ruby-position, ruby-overhang
DrakesBot12 464af06
Merge remote-tracking branch 'upstream/main' into css/ruby-align-posi…
DrakesBot12 2ef4a10
Merge branch 'main' into css/ruby-align-position-overhang
DrakesBot12 686598e
Merge branch 'main' into css/ruby-align-position-overhang
DrakesBot12 fc147eb
Добавляет baseline-конфиги
vitya-ne 1910801
Делаем доку лучше :^
DrakesBot12 580301e
Делаем доку лучше :^
DrakesBot12 fa98b4e
Делаем доку лучше :^
DrakesBot12 c307c6c
Делаем доку лучше :^
DrakesBot12 aee8aed
Делаем доку лучше :^
DrakesBot12 0bc53d2
Делаем доку лучше :^
DrakesBot12 788c708
Делаем доку лучше :^
DrakesBot12 05980b4
Делаем доку лучше :^
DrakesBot12 3a38de4
правки
DrakesBot12 8548d14
правки. форматирование
DrakesBot12 52681fe
+adaptive
DrakesBot12 803f382
ruby-merge + link to spec everywhere
DrakesBot12 e8a0e9e
форматирование
DrakesBot12 72151b8
adaptive
DrakesBot12 035e248
улучшения
DrakesBot12 88126fb
улучшения
DrakesBot12 a0200c6
правка
DrakesBot12 c69c5d2
улучшения
DrakesBot12 877f3f1
Обновляет ветку для прогона проверок
solarrust fdadcaf
Исправляет букву «ё» в статье про ruby-merge
solarrust de2b102
Merge branch 'main' into css/ruby-align-position-overhang
solarrust f146fb6
Чинит внутренние ссылки без слеша в конце
solarrust 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="ru"> | ||
| <head> | ||
| <title>Выравнивание аннотаций ruby-align — ruby-align — Дока</title> | ||
| <meta charset="utf-8"> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1"> | ||
| <link rel="preconnect" href="https://fonts.googleapis.com"> | ||
| <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> | ||
| <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500&display=swap"> | ||
| <style> | ||
| *, *::before, *::after { | ||
| margin: 0; | ||
| padding: 0; | ||
| box-sizing: border-box; | ||
| } | ||
|
|
||
| html { | ||
| color-scheme: dark; | ||
| } | ||
|
|
||
| body { | ||
| min-height: 100vh; | ||
| padding: 50px; | ||
| font-size: 3rem; | ||
| display: flex; | ||
| align-items: center; | ||
| justify-content: center; | ||
| background-color: #18191C; | ||
| color: #FFFFFF; | ||
| font-family: "Roboto", sans-serif; | ||
| } | ||
|
|
||
| @media (max-width: 768px) { | ||
| body { | ||
| padding: 30px; | ||
| } | ||
| } | ||
|
|
||
| ruby { | ||
| text-align: center; | ||
| ruby-align: center; | ||
| } | ||
|
|
||
| rt { | ||
| color: #FF8630; | ||
| } | ||
|
|
||
| .container { | ||
| display: grid; | ||
| width: 100%; | ||
| grid-template-columns: repeat(3, 1fr); | ||
| } | ||
| </style> | ||
| </head> | ||
| <body> | ||
| <div class="container"> | ||
| <ruby> | ||
| 風林 | ||
| <rp> (</rp><rt>Ветер и лес</rt><rp>) </rp> | ||
| </ruby> | ||
| <ruby> | ||
| 火山 | ||
| <rp> (</rp><rt>Огонь и гора</rt><rp>) </rp> | ||
| </ruby> | ||
| <ruby> | ||
| 雨月 | ||
| <rp> (</rp><rt>Дождь и луна</rt><rp>) </rp> | ||
| </ruby> | ||
| </div> | ||
| </body> | ||
| </html> |
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,137 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="ru"> | ||
| <head> | ||
| <title>Интерактивная демка по ruby-align — ruby-align — Дока</title> | ||
| <meta charset="utf-8"> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1"> | ||
| <link rel="preconnect" href="https://fonts.googleapis.com"> | ||
| <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> | ||
| <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500&display=swap"> | ||
| <style> | ||
| *, *::before, *::after { | ||
| margin: 0; | ||
| padding: 0; | ||
| box-sizing: border-box; | ||
| } | ||
|
|
||
| html { | ||
| color-scheme: dark; | ||
| } | ||
|
|
||
| body { | ||
| min-height: 100vh; | ||
| padding: 50px; | ||
| font-size: 3rem; | ||
| display: flex; | ||
| align-items: center; | ||
| justify-content: center; | ||
| background-color: #18191C; | ||
| color: #FFFFFF; | ||
| font-family: "Roboto", sans-serif; | ||
| } | ||
|
|
||
| @media (max-width: 768px) { | ||
| body { | ||
| padding: 30px; | ||
| } | ||
| } | ||
|
|
||
| ruby { | ||
| text-align: center; | ||
| ruby-align: center; | ||
| } | ||
|
|
||
| rt { | ||
| margin-bottom: .5rem; | ||
| color: #FF8630; | ||
| } | ||
|
|
||
| .container { | ||
| display: flex; | ||
| justify-content: space-between; | ||
| width: 100%; | ||
| } | ||
|
|
||
| select { | ||
| padding: 0.4em 0.6em; | ||
| border-radius: 4px; | ||
| font-size: 1rem; | ||
| } | ||
|
|
||
| .selector-container { | ||
| display: flex; | ||
| align-items: center; | ||
| flex-direction: column-reverse; | ||
| } | ||
|
|
||
| #ruby-1 { | ||
| ruby-align: start; | ||
| } | ||
|
|
||
| #ruby-3 { | ||
| ruby-align: space-between; | ||
| } | ||
| </style> | ||
| </head> | ||
| <body> | ||
| <div class="container"> | ||
| <div class="selector-container"> | ||
| <div class="selector"> | ||
| <label> | ||
| <select data-target="ruby-1"> | ||
| <option value="start" selected>start</option> | ||
| <option value="center">center</option> | ||
| <option value="space-between">space-between</option> | ||
| <option value="space-around">space-around</option> | ||
| </select> | ||
| </label> | ||
| </div> | ||
| <ruby id="ruby-1"> | ||
| 山川 | ||
| <rp> (</rp><rt>Горы и реки</rt><rp>) </rp> | ||
| </ruby> | ||
| </div> | ||
| <div class="selector-container"> | ||
| <div class="selector"> | ||
| <label> | ||
| <select data-target="ruby-2"> | ||
| <option value="start">start</option> | ||
| <option value="center" selected>center</option> | ||
| <option value="space-between">space-between</option> | ||
| <option value="space-around">space-around</option> | ||
| </select> | ||
| </label> | ||
| </div> | ||
| <ruby id="ruby-2"> | ||
| 花鳥 | ||
| <rp> (</rp><rt>Цветы и птицы</rt><rp>) </rp> | ||
| </ruby> | ||
| </div> | ||
| <div class="selector-container"> | ||
| <div class="selector"> | ||
| <label> | ||
| <select data-target="ruby-3"> | ||
| <option value="start">start</option> | ||
| <option value="center">center</option> | ||
| <option value="space-between" selected>space-between</option> | ||
| <option value="space-around">space-around</option> | ||
| </select> | ||
| </label> | ||
| </div> | ||
| <ruby id="ruby-3"> | ||
| 日月 | ||
| <rp> (</rp><rt>Солнце и луна</rt><rp>) </rp> | ||
| </ruby> | ||
| </div> | ||
| </div> | ||
| <script> | ||
| document.querySelectorAll('select').forEach(select => { | ||
| select.addEventListener('change', (e) => { | ||
| const rubyId = e.target.dataset.target; | ||
| const value = e.target.value; | ||
| document.getElementById(rubyId).style.rubyAlign = value; | ||
| }); | ||
| }); | ||
|
DrakesBot12 marked this conversation as resolved.
Outdated
|
||
| </script> | ||
| </body> | ||
| </html> | ||
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,80 @@ | ||
| --- | ||
| title: "`ruby-align`" | ||
| description: "Выравниваем аннотаций относительно базового текста с помощью нативного CSS!" | ||
|
DrakesBot12 marked this conversation as resolved.
Outdated
|
||
| baseline: | ||
| - group: ruby-align | ||
| features: | ||
| - css.properties.ruby-align | ||
| - css.properties.ruby-align.center | ||
| - css.properties.ruby-align.space-around | ||
| - css.properties.ruby-align.space-between | ||
| - css.properties.ruby-align.start | ||
| authors: | ||
| - drakesbot12 | ||
| keywords: | ||
| - руби | ||
| - ruby | ||
| - выравнивание | ||
| - японский | ||
| related: | ||
| - html/ruby | ||
| - css/ruby-position | ||
| - css/writing-mode | ||
| tags: | ||
| - doka | ||
| --- | ||
|
|
||
| ## Кратко | ||
|
|
||
| Свойство `ruby-align` определяет, как аннотации (руби-текст) выравниваются относительно базового текста в элементе [`<ruby>`](/html/ruby/). Это полезно при работе с восточноазиатскими языками, особенно японским. | ||
|
|
||
| ## Пример | ||
|
|
||
| ```html | ||
| <ruby> | ||
| 風林 | ||
| <rp> (</rp><rt>Ветер и лес</rt><rp>) </rp> | ||
| </ruby> | ||
| <ruby> | ||
| 火山 | ||
| <rp> (</rp><rt>Огонь и гора</rt><rp>) </rp> | ||
| </ruby> | ||
| <ruby> | ||
| 雨月 | ||
| <rp> (</rp><rt>Дождь и луна</rt><rp>) </rp> | ||
| </ruby> | ||
| ``` | ||
|
|
||
| ```css | ||
| ruby { | ||
| ruby-align: center; | ||
| } | ||
| ``` | ||
|
|
||
| <iframe title="Выравнивание аннотаций ruby-align" src="demos/basic/" height="200"></iframe> | ||
|
|
||
| ## Как пишется | ||
|
|
||
| ```css | ||
| .element { | ||
| ruby-align: start | center | space-between | space-around; | ||
|
DrakesBot12 marked this conversation as resolved.
Outdated
|
||
| } | ||
| ``` | ||
|
|
||
| - `start` — аннотация выравнивается по началу текста (значение по умолчанию). | ||
| - `center` — аннотация выравнивается по центру символов базового текста. | ||
| - `space-between` — аннотации распределяются с равными промежутками между символами основного текста. | ||
| - `space-around` — аннотации распределяются с равными промежутками вокруг символов. | ||
|
|
||
| Свойство работает только внутри элементов с `display: ruby` и аннотациями `<rt>`. | ||
|
|
||
| ## Как понять | ||
|
|
||
| Когда вы используете аннотации над или под иероглифами (например, японскими), важно контролировать, как они соотносятся с основным текстом. Это особенно критично при сложных фразах или вертикальном письме. `ruby-align` позволяет точно управлять этим выравниванием. | ||
|
|
||
| <iframe title="Интерактивная демка по ruby-align" src="demos/practis/" height="250"></iframe> | ||
|
|
||
| ## Подсказки | ||
|
|
||
| 💡 Свойство `ruby-align` применяется только к родительскому элементу [`<ruby>`](/html/ruby/). | ||
| 💡 Чтобы аннотации были видны, используйте элементы [`<ruby>`](/html/ruby/) и `<rt>`, а также корректный HTML-структурный контент. | ||
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,79 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="ru"> | ||
| <head> | ||
| <title>Пример работы ruby-overhang — ruby-overhang — Дока</title> | ||
| <meta charset="utf-8"> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1"> | ||
| <link rel="preconnect" href="https://fonts.googleapis.com"> | ||
| <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> | ||
| <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500&display=swap"> | ||
| <style> | ||
| *, *::before, *::after { | ||
| margin: 0; | ||
| padding: 0; | ||
| box-sizing: border-box; | ||
| } | ||
|
|
||
| html { | ||
| color-scheme: dark; | ||
| } | ||
|
|
||
| body { | ||
| min-height: 100vh; | ||
| padding: 50px; | ||
| font-size: 3rem; | ||
| display: flex; | ||
| align-items: center; | ||
| justify-content: center; | ||
| background-color: #18191C; | ||
| color: #FFFFFF; | ||
| font-family: "Roboto", sans-serif; | ||
| } | ||
|
|
||
| @media (max-width: 768px) { | ||
| body { | ||
| padding: 30px; | ||
| } | ||
| } | ||
|
|
||
| ruby { | ||
| text-align: center; | ||
| ruby-align: center; | ||
| } | ||
|
|
||
| rt { | ||
| color: #FF8630; | ||
| } | ||
|
|
||
| .container { | ||
| display: grid; | ||
| width: 100%; | ||
| grid-template-columns: repeat(2, 1fr); | ||
| } | ||
|
|
||
| .auto { | ||
| ruby-overhang: auto; | ||
| } | ||
|
|
||
| .none { | ||
| ruby-overhang: none; | ||
| } | ||
| </style> | ||
| </head> | ||
| <body> | ||
| <div class="container"> | ||
| <ruby class="auto"> | ||
| 表 | ||
| <rp> (</rp> | ||
| <rt>поверхность</rt> | ||
| <rp>) </rp> | ||
| </ruby> | ||
| <ruby class="none"> | ||
| 現 | ||
| <rp> (</rp> | ||
| <rt>проявление</rt> | ||
| <rp>) </rp> | ||
| </ruby> | ||
| </div> | ||
| </body> | ||
| </html> |
Oops, something went wrong.
Oops, something went wrong.
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.