Figure 4.3.1: Ruby overhanging adjacent text
Figure 4.3.2: Ruby overhanging preceding text only
Figure 4.3.3: Ruby overhanging following text only
Figure 4.3.4: Ruby not allowed to overhang adjacent text
Name: | ruby-span |
---|---|
Value: | attr(x) | none |
Initial: | none |
Applies to: | elements with display: ruby-text |
Inherited: | no |
Percentages: | N/A |
Media: | visual |
Computed value: | <number> |
This property controls the spanning behavior of annotation elements.
Note: A XHTML user agent may also use the rbspan attribute to get the same effect.
Possible values:
The following example shows an XML example using the 'display' property values associated with the 'ruby structure and the 'ruby-span' property
myruby { display: ruby; } myrbc { display: ruby-base-container; } myrb { display: ruby-base; } myrtc.before { display: ruby-text-container; ruby-position: before} myrtc.after { display: ruby-text-container; ruby-position: after} myrt { display: ruby-text; ruby-span: attr(rbspan); } ... <myruby> <myrbc> <myrb>10</myrb> <myrb>31</myrb> <myrb>2002</myrb> </myrbc> <myrtc class="before"> <myrt>Month</myrt> <myrt>Day</myrt> <myrt>Year</myrt> </myrtc> <myrtc class="after"> <myrt rbspan="3">Expiration Date</myrt> </myrtc> </myruby>-->
This section is informative.
The following represents a default UA style sheet for rendering HTML and XHTML ruby markup as ruby layout:
ruby { display: ruby; } rb { display: ruby-base; white-space: nowrap; } rt { display: ruby-text; white-space: nowrap; font-size: 50%; } rbc { display: ruby-base-container; } rtc { display: ruby-text-container; } ruby, rb, rt, rbc, rtc { unicode-bidi: isolate; }
Additional rules for UAs supporting the relevant features of [CSS3-TEXT-DECOR] and [CSS3-FONTS]:
rt { font-variant-east-asian: ruby; text-emphasis: none; }
Authors should not use the above rules; a UA that supports ruby layout should provide these by default.
The following represents a sample style sheet for rendering HTML and XHTML ruby markup as inline annotations:
ruby, rb, rt, rbc, rtc, rp { display: inline; white-space: inherit; font-variant-east-asian: inherit; text-emphasis: inherit; }
Unfortunately, because Selectors cannot match against text nodes, it's not possible with CSS to express rules that will automatically and correctly add parentheses to unparenthesized ruby annotations in HTML. (This is because HTML ruby allows implying the ruby base from raw text, without a corresponding element.) However, these rules will handle cases where either <rb>
or <rtc>
is used rigorously.
/* Parens around <rtc> */ rtc::before { content: "("; } rtc::after { content: ")"; } /* Parens before first <rt> not inside <rtc> */ rb + rt::before, rtc + rt::before { content: "("; } /* Parens after <rt> not inside <rtc> */ rb ~ rt:last-child::after, rt + rb::before { content: ")"; } rt + rtc::before { content: ")("; }
Conformance requirements are expressed with a combination of descriptive assertions and RFC 2119 terminology. The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in the normative parts of this document are to be interpreted as described in RFC 2119. However, for readability, these words do not appear in all uppercase letters in this specification.
All of the text of this specification is normative except sections explicitly marked as non-normative, examples, and notes. [RFC2119]
Examples in this specification are introduced with the words “for example” or are set apart from the normative text with class="example"
, like this:
This is an example of an informative example.
Informative notes begin with the word “Note” and are set apart from the normative text with class="note"
, like this:
Note, this is an informative note.
Conformance to CSS Ruby Module is defined for three conformance classes:
A style sheet is conformant to CSS Ruby Module if all of its statements that use syntax defined in this module are valid according to the generic CSS grammar and the individual grammars of each feature defined in this module.
A renderer is conformant to CSS Ruby Module if, in addition to interpreting the style sheet as defined by the appropriate specifications, it supports all the features defined by CSS Ruby Module by parsing them correctly and rendering the document accordingly. However, the inability of a UA to correctly render a document due to limitations of the device does not make the UA non-conformant. (For example, a UA is not required to render color on a monochrome monitor.)
An authoring tool is conformant to CSS Ruby Module if it writes style sheets that are syntactically correct according to the generic CSS grammar and the individual grammars of each feature in this module, and meet all other conformance requirements of style sheets as described in this module.
So that authors can exploit the forward-compatible parsing rules to assign fallback values, CSS renderers must treat as invalid (and ignore as appropriate) any at-rules, properties, property values, keywords, and other syntactic constructs for which they have no usable level of support. In particular, user agents must not selectively ignore unsupported component values and honor supported values in a single multi-value property declaration: if any value is considered invalid (as unsupported values must be), CSS requires that the entire declaration be ignored.
To avoid clashes with future CSS features, the CSS2.1 specification reserves a prefixed syntax for proprietary and experimental extensions to CSS.
Prior to a specification reaching the Candidate Recommendation stage in the W3C process, all implementations of a CSS feature are considered experimental. The CSS Working Group recommends that implementations use a vendor-prefixed syntax for such features, including those in W3C Working Drafts. This avoids incompatibilities with future changes in the draft.
Once a specification reaches the Candidate Recommendation stage, non-experimental implementations are possible, and implementors should release an unprefixed implementation of any CR-level feature they can demonstrate to be correctly implemented according to spec.
To establish and maintain the interoperability of CSS across implementations, the CSS Working Group requests that non-experimental CSS renderers submit an implementation report (and, if necessary, the testcases used for that implementation report) to the W3C before releasing an unprefixed implementation of any CSS features. Testcases submitted to W3C are subject to review and correction by the CSS Working Group.
Further information on submitting testcases and implementation reports can be found from on the CSS Working Group's website at http://www.w3.org/Style/CSS/Test/. Questions should be directed to the [email protected] mailing list.
This specification would not have been possible without the help from:
Stephen Deach, Martin Dürst, Hideki Hiura(樋浦 秀樹), Masayasu Ishikawa(石川 雅康), Chris Pratley, Takao Suzuki(鈴木 孝雄), Frank Yung-Fong Tang, Chris Thrasher, Masafumi Yabe家辺 勝文), Steve Zilles.
The following major changes have been made since the previous Working Draft:
ruby-span
’ and mentions of rbspan
. ruby-overhang
’ and ‘ruby-align: line-end
’ to Level 2. display: rp
’: use ‘display: none
’. display: none
’. ruby-position
’ values to match ‘text-emphasis-position
’. inter-character
’, which we need to keep, it makes more sense to align ruby positions with ‘text-emphasis-position
’, which can correctly handle various combinations of horizontal/vertical preferences. ruby-align
’. left
’, ‘right
’, and ‘end
’ are not needed. auto
’, ‘distribute-letter
’, and ‘distribute-space
’ from ‘ruby-align
’ with ‘space-between
’ and ‘space-around
’. auto
’ value relied on inspecting content to determine behavior; this can be avoided by just using ‘space-around
’ with standard justification rules (which allow spacing between CJK but not between Latin). Replaced ‘distribute-letter
’ and ‘distribute-space
’ with ‘space-between
’ and ‘space-around
’ for consistency with distribution keywords in [CSS3-FLEXBOX] and [CSS3-ALIGN] and to avoid any links to the definition of ‘text-justify: distribute
’. ruby-merge
’ property to control jukugo rendering. inline
’ from ‘ruby-position
’. display: inline
’ on all the ruby-related elements, see Appendix A Property | Values | Initial | Applies to | Inh. | Percentages | Media |
---|---|---|---|---|---|---|
ruby-align | start | center | space-between | space-around | space-around | ruby bases, ruby annotations, ruby base containers, ruby annotation containers | yes | N/A | visual |
ruby-merge | separate | collapse | auto | separate | ruby annotation containers | yes | N/A | visual |
ruby-position | [ over | under | inter-character ] && [ right | left ] | over right | ruby annotation containers | yes | N/A | visual |