Skip to content

[css-ruby] Applicability and effect of margin / border / padding on ruby containers #4976

Closed

Description

@frivoal

Whether margin / border / padding affect ruby container boxes, and if so how, is not defined. They are generally assumed to be similar to inline boxes in many ways, but they're not actually inline boxes, and since they have internal structure, things may need to be defined.

In Chrome / safari, they apply, and have the same effect as on inline boxes. They affect painting, and they affect layout in the inline direction but not in the block direction.

In Firefox, they also apply, but have a subtly different effect. They also affect painting, and also affect layout in the inline direction, but unlike chrome/safari, there is an effect on layout in the block direction as well: a positive padding-top or border-top-width if ruby-position is over, or a positive padding-bottom or border-bottom-width if ruby-position is under will reduce the additional leading added by section 3.5, until that additional leading is reduced to 0. If border+padding is larger than the additional leading, there is no further effect.

I suspect this effect is not intentional, and that block-axis margins / borders / padding on a ruby container should be specified to have no effect on layout.

The effects of margin/border/padding in the inline direction seem reasonable, interoperable, and uncomplicated. So I think we should spec that they do work.

From there, it would make sense that the effects on painting be kept as well (and they're interoperable).

Activity

  1. self-assigned this
    on Apr 20, 2020
  2. upsuper commented on Apr 29, 2020

    @upsuper
    Member

    Yeah it's probably not intentional in Firefox. It's probably a bug related to how Firefox calculates the block offset of inline elements. I don't think this behavior makes much sense.

    (Note to myself: this may related to these lines of code)

  3. css-meeting-bot commented on May 6, 2020

    @css-meeting-bot
    Member

    The CSS Working Group just discussed Applicability and effect of margin / border / padding on ruby containers, and agreed to the following:

    • RESOLVED: ruby containers behave like inline boxes, and thus behavior of these properties is the same as for regular inline boxes
    The full IRC log of that discussion <emilio> topic: Applicability and effect of margin / border / padding on ruby containers
    <astearns> github: https://github.com//issues/4976
    <emilio> florian: so margin / border / padding applies to bases and annotations
    <emilio> ... and then others get wrapped around them so that part is fine
    <emilio> ... this is only about the ruby container itself
    <emilio> ... as an inline you'd expect that padding / border / margin have no effect on layout
    <emilio> ... so e.g padding applies to the background but doesn't move stuff around
    <emilio> fantasai: so we should say that they behave like inline, because we have controls to change behavior there
    <emilio> florian: I agree, though currently in FF it's different, though I guess that's a bug
    <emilio> florian: xidorn seems to agree
    <emilio> florian: FF does it so that stuff decreases to make room for the ruby
    <emilio> ... which doesn't seem something that would happen intentionally
    <emilio> RESOLVED: ruby containers behave like inline boxes, and thus behavior of these properties is the same as for regular inline boxes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions