8000 [css-ruby][css-inline][css-pseudo] Interaction of initial letter and ruby · Issue #654 · w3c/csswg-drafts · GitHub
[go: up one dir, main page]

Skip to content

[css-ruby][css-inline][css-pseudo] Interaction of initial letter and ruby #654

@frivoal

Description

@frivoal

I believe it is well defined what happens if you do this:

span {
  font-size: 3em;
}
<p><ruby>
  <rb><span></span></rb>
  <rp>(</rp><rt>今日</rt><rp>)</rp>
<ruby></p>

On the other hand, I am not sure it is defined what happens if you do that:

span {
  initial-letter: 3 2;
}
<p><ruby>
  <rb><span></span></rb>
  <rp>(</rp><rt>今日</rt><rp>)</rp>
<ruby></p>

On the one hand, these parts of https://drafts.csswg.org/css-ruby-1/#ruby-layout should still work:

Each ruby base container is sized and positioned to contain exactly all of its ruby bases’ margin boxes

and

Ruby annotation containers are stacked outward over or under their corresponding ruby base container, without any intervening space.

On the other hand, I am not sure this one does:

When a ruby structure is laid out, its base level is laid out on the line, aligned according to its vertical-align property exactly as if its ruby bases were a regular sequence of inline boxes.

Does it mean initial-letter applies normally? Presumably, if it does, then we can then apply the previously quoted rules, and the ruby base container, by including all of its ruby bases’ margin boxes includes the full size of the initial letter, and from there, positioning the ruby annotation containers works as usual.

Or does it instead negate the effect of initial-letter?

I don't think this is a case authors would typically do intentionally (although who knows, there is no bound to author creativity). But regardless, this needs to be defined. Also, this, which is the same, might occur by accident:

p::first-letter {
  initial-letter: 3 2;
}
<p><ruby>
  <rb>今日</rb>
  <rp>(</rp><rt>今日</rt><rp>)</rp>
<ruby></p>

As far as I can tell from css-pseudo, ::first-letter would select 今, and we're back in the same situation.
(with that said, implementations are inconsistent about that: FF and IE/Edge do select it, but chrome and safari don't).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0