Movatterモバイル変換


[0]ホーム

URL:


IDPF

Alternate Style Tags 1.1

Recommended Specification5 January 2017

This version
http://www.idpf.org/epub/altss-tags/altss-tags-20170105.html
Latest version
http://www.idpf.org/epub/altss-tags/
Previous version
http://www.idpf.org/epub/altss-tags/altss-tags-20161130.html
Previous recommendation
http://www.idpf.org/epub/altss-tags/altss-tags-20140626.html
Document history

Editors

Elika J. Etemad, Invited Expert

Copyright © 2011 International Digital Publishing Forum™

All rights reserved. This work is protected under Title 17 of the United States Code. Reproduction and dissemination of this work with changes is prohibited except with the written permission of theInternational Digital Publishing Forum (IDPF).

EPUB is a registered trademark of the International Digital Publishing Forum.

Status of this Document

This section describes the status of this document at the time of its publication. Other documents might supersede this document.

This document was produced by the EPUB Working Group under theEPUB Working Group Charter approved on 8 July 2015.

This document has been reviewed by the IDPF membership and is endorsed by the IDPF Board as a Recommended Specification. This document is considered stable and can be referenced from other specifications and documents.

Feedback on this document can be provided to the EPUB Working Group'smailing list orissue tracker.

This document is governed by theIDPF Policies and Procedures.

  1 Introduction

This section is informative

This module defines a pattern for tagging alternate style sheets using a microformat. It can be used to define standardized classes that can be hooked into the browser UI. Sample use cases include horizontal-vertical layout switches in Japanese ebook readers; automatically selecting high-contrast styles; and other accessibility concerns.

HTML 4.0 defines the linking of external style sheets using thelink element. Although typically a style sheet is linked in unconditionally, HTML 4 also definesalternate style sets, which are named, mutually-exclusive sets of style sheets that the reader can use to alter the display.

Until now, few[HTML] user agents have exposed alternate styles in a meaningful way. However, alternate styles are a very simple way to allow the user to alter a document's presentation to his or her preferences and accessibility needs.

This specification takes advantage of theclass attribute of the HTMLlink element (introduced in[HTML], but supported in many user agents for much longer) to definestyle tags: a markup pattern for tagging style sheets with standardized class names. These class names can be used by a UA to offer special UI access to such tagged style sets.

The original impetus for this proposal was to offer standard controls for switching between horizontal and vertical layouts in Japanese ebook readers; this use case is addressed inAppendix A,Vertical Text Style Set Tags.

  2 Conformance

None of this specification applies if the UA has unilaterally turned author style sheets off. (This ability is mandated by HTML and CSS.) In this case, of course, all style sheets are disabled.

The[CSSOM] has more low-level controls for controlling whether a given style sheet is enabled or disabled; scripting the CSSOMmay alter the behavior defined here.

note

Future versions of this specification will define error handling rules and interaction with[CSSOM].

The keywordsMUST,MUST NOT,REQUIRED,SHALL,SHALL NOT,SHOULD,SHOULD NOT,RECOMMENDED,MAY, andOPTIONAL in this document are to be interpreted as described in[RFC2119].

All sections and appendixes of this specification are normative except where identified by the informative status label "This section is informative". The application of informative status to sections and appendices applies to all child content and subsections they contain.

All examples in this specification are informative.

  3 Style Sets

This section is informative

This is an informative summary of HTML's declarative alternate style set mechanism, with a few slight changes to terminology.

HTML 4 defines two types of style sheets in its linking mechanism: persistent style sheets and alternate style sheets.

Apersistent style sheet is one that is always enabled, regardless of which alternate style set is enabled. A persistent style sheet is indicated by omitting thetitle attribute from thelink orstyle element that imports it.

Analternate style sheet is one that is part of an alternate set, and can be enabled or disabled as part of that set. An alternate style sheet is indicated by setting a non-empty value for thetitle attribute of thelink orstyle that imports it. Except for style sheets belonging to apreferred style set (see below), alternate style sheets have to have analternate value in therel attribue value addition to thestylesheet value.

HTML allows the grouping of multiple alternate style sheets into a single, namedalternate style set. All alternate style sheets with the sametitle value belong to the same style set.

The author can indicate whether an alternate style set ispreferred by omitting thealternate value from therel attribute of each of its component alternate style sheets. If no preferred style sets are defined, the default preferred style set is an unnamed set containing no alternate style sheets.

By default, the first preferred style set is loaded. The author can override this behavior with theDefault-Style meta or HTTP header as defined in[HTML401].

  4 Tagging Style Sets

A style sheet can be tagged by adding the tag's name to theclass attribute of thelink orstyle element that imports it. Tagging a style sheet with astandard style tag (one defined by a specification referencing this specification) indicates that itimplements the functionality described by the style tag's definition. Both alternate style sheets and persistent style sheetsmay be tagged in this way.

A style set can be tagged by tagging any one of its component style sheets. Tagging a style set indicates that itoffers the functionality described by the style tag's definition.

Authors using standard tagsshould tag all alternate style sheets within a style set with the same set of standard tags.

note

Future versions of this specification might allow UAs to selectively disable tagged style sheets within a style set. Therefore all alternate style sheets that need to be enabled or disabled together have to have the same set of standard tags.

If two style sheets within a style set are tagged with mutually exclusive tags, both tags are ignored.

A specification that defines style tagsmay indicate that a particular tag is assumed to be the default for untagged style sets.

  Appendix A. Vertical Text Style Set Tags

The following style tags are defined by this appendix:

horizontal

This style set provides a primarily horizontal presentation of text. This tag is mutually exclusive withvertical.

vertical

This style set provides a primarily vertical presentation of text. This tag is mutually exclusive withhorizontal.

The UAmay guess whether an untagged style set ishorizontal orvertical, ormay instead assign such a style set an indeterminate state.

Examples

The following examples use XHTML syntax; to use HTML syntax, simply drop the slash before the> in the tags.

In the following example, the author provides a style sheet for a primarily horizontal-text presentation of the document:

   <link rel="stylesheet" href="horizontal.css"/>

The UA, knowing that only a horizontal version is provided, would have to synthesize a vertical style if one is needed.

In the following example, the author provides a style sheet for a primarily vertical-text presentation of the document:

   <link rel="stylesheet" href="vertical.css"/>

The UA, knowing that only a vertical version is provided, would have to synthesize a horizontal style if one is needed.

In the following example, the author provides style sheets for both horizontal-text and vertical-text presentations of the document:

  <link rel="stylesheet" href="horizontal.css" title="横組"/>  <link rel="alternate stylesheet" href="vertical.css" title="縦組"/>

Since only the second style set is marked with thealternate value of therel attribute, the author has indicated a preference for the horizontal style set which, in the absence of a user override, should be used by default.

In the following example, the author provides style sheets for both horizontal-text and vertical-text presentations of the document:

  <link rel="alternate stylesheet" href="horizontal.css" title="横組"/>  <link rel="stylesheet" href="vertical.css" title="縦組"/>

Since only the first style set is marked with thealternate value of therel attribute, the author has indicated a preference for the vertical style set which, in the absence of a user override, should be used by default.

In the following example, the author provides style sheets for both horizontal-text and vertical-text presentations of the document:

  <link rel="stylesheet" href="horizontal.css" title="横組"/>  <link rel="stylesheet" href="vertical.css" title="縦組"/>

Since neither is marked with thealternate value of therel attribute, both are preferred presentations by the author. Since the horizontal presentation is provided first, in the absence of a user preference to the contrary, it will be used by default.

  Appendix B. Night Vision Style Set Tags

The following style tags are defined by this appendix:

day

This style set provides a color scheme suited for daytime use (light background, dark text). This tag is mutually exclusive withnight.

night

This style set provides a color scheme suited for nighttime use (dark background, light text). This tag is mutually exclusive withday.

Examples

In the following example, the author provides style sheets for both both day vision and night vision presentations of the document. Both horizontal-text and vertical-text presentations are available, but the horizontal presentation is preferred:

  <link rel="alternate stylesheet" href="vertical.css" title="Vertical Day"  <link rel="alternate stylesheet" href="day.css"           title="Vertical Day"/>  <link rel="alternate stylesheet" href="vertical.css" title="Vertical Night"/>  <link rel="alternate stylesheet" href="night.css"       title="Vertical Night"/>  <link rel="stylesheet" href="horizontal.css" title="Horizontal Day"/>  <link rel="stylesheet" href="day.css"               title="Horizontal Day"/>  <link rel="stylesheet" href="horizontal.css" title="Horizontal Night"/>  <link rel="stylesheet" href="night.css"           title="Horizontal Night"/>

Of the preferred style sets, the day vision variant is listed first, and so in the absence of other preferences will be loaded by default.

The same effect can be created with fewer link tags by using @import statements:

  <link rel="alternate stylesheet" href="vertical-day.css"     title="Vertical Day"/>  <link rel="alternate stylesheet" href="vertical-night.css" title="Vertical Night"/>  <link rel="stylesheet" href="horizontal-day.css"     title="Horizontal Day"/>  <link rel="stylesheet" href="horizontal-night.css" title="Horizontal Night"/>

where vertical-day.css is

  @import "vertical.css";  @import "day.css";

and vertical-night.css is

  @import "vertical.css";  @import "night.css";

and horizontal-day.css is

  @import "horizontal.css";  @import "day.css";

and vertical-night.css is

  @import "horizontal.css";  @import "night.css";

  Appendix C. Acknowledgements

This draft resulted from discussion in theW3C CSS Working Group and theIDPF EPUB Working Group and would not exist without the particular suggestion ofAnne van Kesteren.

  References

Normative References

[HTML]HTML.

[HTML401]HTML 4.01 Specification.Dave Raggett, et al.24 December 1999.

[RFC2119]Key words for use in RFCs to Indicate Requirement Levels (RFC 2119).March 1997.

Informative References

[CSSOM]CSSOM.Anne van Kesteren.


[8]ページ先頭

©2009-2025 Movatter.jp