CSS Round Display Level 1

Editor’s Draft,

This version:
https://drafts.csswg.org/css-round-display/
Latest published version:
https://www.w3.org/TR/css-round-display-1/
Previous Versions:
https://www.w3.org/TR/2016/WD-css-round-display-1-20160301/
https://www.w3.org/TR/2015/WD-css-round-display-1-20150922/
Issue Tracking:
GitHub
Inline In Spec
Editors:
(LG Electronics)
(LG Electronics)
Former Editor:
(LG Electronics)

Abstract

This document describes CSS extensions to support a round display. The extensions help web authors to build a web page suitable for a round display.

CSS is a language for describing the rendering of structured documents (such as HTML and XML) on screen, on paper, in speech, etc.

Status of this document

This is a public copy of the editors’ draft. It is provided for discussion only and may change at any moment. Its publication here does not imply endorsement of its contents by W3C. Don’t cite this document other than as work in progress.

GitHub Issues are preferred for discussion of this specification. When filing an issue, please put the text “css-round-display” in the title, preferably like this: “[css-round-display] …summary of comment…”. All issues and comments are archived, and there is also a historical archive.

This document was produced by the CSS Working Group (part of the Style Activity).

This document was produced by a group operating under the 5 February 2004 W3C Patent Policy. W3C maintains a public list of any patent disclosures made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) must disclose the information in accordance with section 6 of the W3C Patent Policy.

This document is governed by the 1 September 2015 W3C Process Document.

1. Introduction

Conventionally, web pages have been shown through a rectangular screen such as PC, tablet, and smart phone. The window content area in a web browser is a rectangle. Each HTML element follows the W3C box model and thus is also a rectangle.
Nowadays, devices come in varied shapes of the displays. It needs to consider the shape of the display when implementing web pages on devices. However, current web standards lack some features to support the devices as follows:

  1. Lack of the capability to detect the shape of a display
  2. Lack of layout mechanisms suitable for the shape of a display
In order to facilitate the use of the web especially on a round display, there could be some features to support it.

The device-radius media feature is added to Media Queries. Current user agents are not capable of detecting the shape of a display so that authors cannot apply various layouts for a round display. To resolve the issue, device-radius informs the web page of the property regarding the shape of the display.

To apply the shape of a display to content area, we extend the shape-inside property of CSS Shapes. The position of the element which is overflowed from the display is adjusted inside the display when using this property even if the authors don’t know the exact shape of the display.

We also add the border-boundary property to CSS Borders. The borders of the element can be drawn along the edge of the display even if the element is overflowed.

For the better web design suitable for a round display, we introduce polar positioning. In conventional positioning method, the Cartesian coordinates, elements are positioned by offsets in x-axis and y-axis. But, we suggest a method to position elements with specifying the distance and angle from the origin point of coordinates.

This module provides features such as:

2. Terminology

This specification follows the CSS property definition conventions from [CSS21].
The detailed description of Media Queries is defined in [MEDIAQUERIES-4]
The detailed description of CSS Shapes is defined in [CSS-SHAPES-1]
The detailed description of Borders is defined in [CSS3-BORDER]
The detailed description of Positioned Layout is defined in [CSS3-POSITIONING]

3. Extending Media Queries for a round display

Media Queries [MEDIAQUERIES-4] define mechanisms to support media-dependent style sheets, tailored for different environments. We propose to extend Media Queries by adding the shape media feature to support various types of displays. This will allow web authors to apply different styles to a web page on the rounded display.

3.1. The shape media feature

To use different style sheets for a rectangle display and for a round display, media queries should support some properties to identify the display shape.
Name: shape
For: @media
Value: rect | round
Type: discrete

Note: To define a discrete type media feature, the feature is evaluated in a boolean context.

The shape media feature describes the general shape of the targeted display area of the output device. It accepts the following values:

rect
The shape is an axis aligned rectangle or square, or a similar shape for which the traditional designs are appropriate.
round
The shape is rounded or a similar shape to the circle such as an oval, an ellipse for which distinctively rounded designs are appropriate.
The example below shows how a web page looks in the different shapes of displays. This is a simple clock written in HTML without shape.
<!DOCTYPE html>
<html>
<head>
    <link rel="stylesheet" href="rectangle.css" />
</head>
<body>
    <div id="clockLayer">
        <div id="clockLayer">
            <div id="date">2015/02/28 (SAT)</div>
            <div id="time">10:11</div>
            <div id="weather"><img src="cloudy.png" /></div>
        </div>
    </div>
</body>
</html>
An image of a rectangle clock within a rectangle display

(A) Rectangle Display

An image of a round clock within a rectangle display

(B) Round Display

Devices where the shape media feature is applicable

On the other hand, the example below shows how the ‘shape’ media feature works in the different shapes of displays. This is the same as the code above except for media queries usage. The shape media feature can be used as follows:

<!-- index.html -->
<head>
    <link media="screen and (shape: rect)" rel="stylesheet" href="rectangle.css" />
    <link media="screen and (shape: round)" rel="stylesheet" href="round.css" />
</head>

If this example code is loaded in a round display, 'round.css' will be applied by the media queries mechanism.

An image of a rectangle clock within a rectangle display

(A) Rectangle Display
(w/ shape: rect)

An image of a round clock within a round display

(B) Round Display
(w/ shape: round)

Devices where the shape media feature is applicable

Note: There are cases when the UA may know the shape even in the absence of OS APIs. For example, when rendering to PDF, the shape is known to be a rectangle, so 'shape: rect' evaluates to true while shape: round to false

Note: For other shapes, such as polygons, we need to extend the media features with additional parameters. The current features have limitations to support the diversity beyond round shapes. How can we express star-shaped polygons? (e.g. SVG syntax, etc.) Of course, there is a trade-off between simplicity and expressiveness.

4. Extending the @viewport rule

4.1. The viewport-fit descriptor

viewport-fit can set the size of the initial viewport [css-device-adapt].

Name: viewport-fit
For: @viewport
Value: auto | contain | cover
Initial: auto
Percentages: N/A
Media: visual, continuous
Computed value: as specified

The initial viewport is seen through the physical screen of the device. On rounded screen, the part of the page that’s currently shown on-screen is round but the viewport is rectangular. Because of this, some part of the page is clipped.

An image of the clipped area between the viewport bounding box and the device’s border
Clipped area

viewport-fit can control the clipped area by setting the size of the initial viewport as changing with the size of the window or viewing area.

Values have the following meanings:

auto
This value doesn’t affect the initial viewport, and the whole web page is viewable. UA can do anything it wants for the reader to view the web page easily.
contain
The initial viewport is the largest rectangle which is inscribed in the display of the device. With this value, 'border-boundary: display' and 'shape-inside: display' have no effect. UA can paint the area which is outside the contained viewport for ‘contain’.
cover
The initial viewport is the circumscribed rectangle of the physical screen of the device.

When setting the size of the bounding box for the viewport on the non-rectangular display, we have to consider the factors like below:

The author can decide which factor is more critical than another. If it have to be guaranteed that any part of the web page isn’t hidden, avoiding clipping is more important than having a gap between the bounding box of the viewport and the border of the screen. If the author doesn’t want web pages to be small for the readability, then it would be better to set ‘viewport-fit’ as ‘cover’ and to implement pages with considering the clipped parts.

This example shows the size of the bounding box for the viewport specified with viewport-fit on the rounded display.

When the viewport-fit is specified with contain, the initial viewport is applied to the largest inscribed rectangle of the display.

@viewport (viewport-fit: contain) {
    /* CSS for the rectangular design */
}      
An image about the viewport applied to the bounding box specified with 'viewport-fit: contain'
With 'viewport-fit: contain'

When cover is given to the viewport-fit, the initial viewport is applied to the circumscribed rectangle of the display.

@viewport (viewport-fit: cover) {
    /* CSS for the rectangular design */
}
An image about the viewport applied to the bounding box specified with 'viewport-fit: cover'
With 'viewport-fit: cover'

5. Aligning content along the display border

5.1. The shape-inside property

CSS Shapes [CSS-SHAPES-1] define the shape-inside property that aligns contents along the edge of a possibly non-rectangular wrapping area. Web authors may use this feature to fit contents inside a round display. However, it can be challenging to specify the wrapping area to be identical to the shape of a display. To address such cases, shape-inside is extended with a new value named 'display', such an element having this value will have its content (or contained elements) aligned along the display border automatically.

Name: shape-inside
Value: auto | outside-shape | [ <basic-shape> || shape-box ] | <image> | display
Initial: auto
Applies to: block-level elements
Inherited: no
Percentages: n/a
Media: visual
Computed value: computed lengths for <basic-shape>, the absolute URI for <uri>, otherwise as specified
Canonical order: per grammar
Animatable: as specified for <basic-shape>, otherwise no

The example below shows how the shape-inside property works when it is set to 'display'. Without using Media Queries, contents can be aligned within the display edge automatically.

<style>
    #container {
        shape-inside: display;
        // the same as circle(50% at 50%, 50%) in a regular round display
    }
    #green-box { float: left; }
    #blue-box { float: right; }
</style>
<div id="container">
    <p>
        Some inline content
        <img id="green-box" src="green-box.jpg" />
        with a float left and float right, in a
        <img id="blue-box" src="blue-box.jpg" />
        simple box with a circle shape-inside.
    </p>
</div>


A layout of web contents without shape-inside:display

(A) Without 'shape-inside'

A layout of web contents with shape-inside: display

(B) With 'shape-inside: display'

Align the content along the display border

This property is specially useful for complex shapes (e.g. curved, stelliform, polygonal), that wouldn’t be covered by <basic-shape> (i.e. circle() or ellipse()), allowing web authors to conveniently align contents with the display edge.

When a containing block is placed on one end of the display and the containing block has 'shape-inside: display', the descendant blocks of the containing block are basically put on the overlapping region between the containing block and the display area. The overlapping region’s shape is mostly complicated shape, so it’s difficult to define the shape using previous method like basic-shape. The figure 4 describes these circumstances as follows.

An image of two examples to show the principle of shape-inside: display
Align the content along the display border

What if content overflows? Clipping or scrolling?

6. Drawing borders around the display border

6.1. The border-boundary property

We add the border-boundary property to set a boundary constraint that affects the borders of an element.

Name: border-boundary
Value: none | parent | display
Initial: none
Applies to: all elements
Inherited: yes
Percentages: n/a
Media: visual
Computed value: as specified
Canonical order: per grammar
Animation type: discrete

When the border-boundary property on an element is set to 'parent', additional borders of the element could be drawn where the element’s area and the borders of its parent are met. When it is set to 'display', additional borders could be drawn where the element’s area and the borders of screen are met. The default value is 'none', imposing no boundary constraint on the borders.

The example below shows how the border-boundary property works on drawing borders. The result is shown in Figure 5B.
<style>
    #container {
        border-boundary: display;
    }
    #redBox {
        border: 5px red solid;
    }
    #greenBox {
        border: 5px green solid;
    }
    #blueBox {
        border: 5px blue solid;
    }
</style>
<div id="container">
    <div id="redBox"></div>
    <div id="greenBox"></div>
    <div id="blueBox"></div>
</div>


An image of circle drawing border lines without border-boundary: display

(A) Without 'border-boundary'

An image of circle drawing border lines with border-boundary: display

(B) With 'border-boundary: display'

Align the content along the display border

Note: If the value of border-boundary is parent or display, border lines of the element are actually just a visual effect. It triggers a layout for rendering in a general way, but in the above cases (border-boundary: parent|display), the layout doesn’t occur and it only draws the border lines inward from the containing block’s borders. With this situation, the borders might hide contents around the display edge.

7. Position the element along the path

This section introduces specifying a path and positioning the element along it.

A path can be defined with offset-path and offset-position. The position of the element on the path is computed by the value of offset-distance and offset-anchor.

7.1. Define the path: The offset-path property

Name: offset-path
Value: <url> | <angle> && contain? | [ <basic-shape> | <path()> ] || <geometry-box> | none
Initial: 0deg for <angle>, otherwise no
Applies to: All elements. In SVG, it applies to container elements excluding the defs element and all graphics elements
Inherited: no
Percentages: N/A
Media: visual
Computed value: as specified
Canonical order: per grammar
Animatable: as specified for angle, otherwise no

Specifies the path the element gets positioned at. The exact element’s position on the path is determined by the offset-distance property. A path is either a specified path with one or multiple sub-paths or the geometry of a not styled basic shape. Each shape or path must define an initial position for the computed value of "0" for offset-distance or the position specified by offset-position. An initial direction which specifies the rotation of the object on the initial position.

Values have the following meanings:

<angle>
The path is a straight line that starts from the current position of the element and has the degree of the angle as specified in <angle> from the Y-axis. The path ends at the edge of the containing block.
contain
Adjust the value of offset-distance when the element goes out of the path. When overflowing occurs, the distance value is reduced, until the end point of the path is on the edge of the element.

Note: Defining the path with <angle>, the element can be positioned in the polar coordinate system. In polar coordinates, a pole is the reference point and points are described as been a certain distance from it, as also a certain angle from the polar axis. In mathematical theory, the polar axis is commonly defined as the positive direction of the x-axis, but we consider the polar axis as the positive direction of the y-axis position as other CSS specifications usually do. Therefore, when the <angle> value of offset-path is 0, the element is positioned on the y-axis. If the <angle> value increases in the positive direction from 0, the element moves clockwise. The method to determine a direction using the <angle> value for offset-path works the same way in [CSS3VAL], <angle> value.

<basic-shape>
The path is a basic shape as specified in CSS Shapes [CSS-SHAPES-1]. The initial position and the initial direction for basic shapes are defined as follows:
<circle()>
<ellipse()>
The initial position is defined by the point where a virtual tangent to the circle/ellipse would reach the top vertical position. The initial direction is 90 degrees.
<inset()>
The initial position is defined by the left top corner of the rectangle. The initial direction is 0 degree.
<polygon()>
The initial position is defined by the first coordinate pair of the polygon. The initial direction is defined by the vector connecting the initial position with the next following coordinate pair that isn’t equal to the initial position. If there is no such unequal coordinate pair, the initial direction is defined with 0 degree.
path() = path([ <fill-rule> ,]? <string>)

The <string> represents an SVG Path data string. The path data string must be conform to the grammar and parsing rules of SVG 1.1 [SVG11]. The initial position is defined by the first “move to” argument in the path string. For the initial direction follow SVG 1.1 [SVG11].

<fill-rule> - The filling rule used to determine the interior of the path. See fill-rule property in SVG for details. Possible values are nonzero or evenodd. Default value when omitted is nonzero.

<url>
References an SVG shape element and uses its geometry as motion path. See SVG 1.1 for more information about the initial position and initial direction [SVG11].
none
No path gets created.

A computed value of other than none results in the creation of a stacking context [CSS21] the same way that CSS opacity [CSS3COLOR] does for values other than 1, unless the element is an SVG element with out an associated CSS layout box.

A reference that fails to download, is not a reference to an SVG shape element element, or is non-existent is ignored. No motion path and no stacking context are created.

For SVG elements without associated CSS layout box, the used value for content-box, padding-box, border-box and margin-box is fill-box.

For elements with associated CSS layout box, the used value for fill-box, stroke-box and view-box is border-box.

Here are some examples. The first example shows some parts of elements are outside of the path.
<body>
  <div style="offset-path: 45deg; offset-distance: 100%"></div>
  <div style="offset-path: 180deg; offset-distance: 100%"></div>
</body>

In the second example, contain, the extent keyword value is added to the offset-path value of each element to avoid overflowing.

<body>
  <div style="offset-path: 45deg contain; offset-distance: 100%"></div>
  <div style="offset-path: 180deg contain; offset-distance: 100%"></div>
</body>

7.2. Define the initial position of the path: The offset-position property

Name: offset-position
Value: auto | <position>
Initial: auto
Applies to: all elements
Inherited: no
Percentages: Refer to the size of containing block
Media: visual
Computed value: as specified
Canonical order: per grammar
Animatable: as position

Specifies the initial position of the path.

Values are defined as follows:

auto
Computes to the current position of the element.
<position>
Values of <position> are defined like below:
<percentage>
A percentage for the horizontal offset is relative to the width of the containing block. A percentage for the vertical offset is relative to height of the containing block.
<length>
A length value gives a fixed length as the offset. The value for the horizontal and vertical offset represent an offset from the top left corner of the containing block.
top
Computes to 0% for the vertical position.
right
Computes to 100% for the horizontal position.
bottom
Computes to 100% for the vertical position.
left
Computes to 0% for the horizontal position.
center
Computes to 50% (left 50%) for the horizontal position if the horizontal position is not otherwise specified, or 50% (top 50%) for the vertical position if it is.

7.3. Position on the path: The offset-distance property

Name: offset-distance
Value: [ <length> | <percentage> <size>? ]
Initial: 0
Applies to: all elements
Inherited: no
Percentages: Refer to the total length of the path
Media: visual
Computed value: as specified
Canonical order: per grammar
Animatable: yes

A distance that describes the position along the specified path.

Values are defined as follows:

<length>
The distance from the initial position of the shape or path to the position of the element. Percentages are relative to the total path length including all sub-paths.
<percentage>
Is relative to the length of the path. The length is a distance between the initial position and the end position which is the contact point of the edge of the containing block and the path.
<size>
Decides a point used for measuring the distance from the initial position of the path.

It is defined as

 <size> = [ closest-side | closest-corner | farthest-side | farthest-corner ]

If omitted it defaults to closest-side.

closet-side
The distance is measured between the initial position and the closest side of the box from it.
closest-corner
The distance is measured between the initial position and the closest corner of the box from it.
farthest-side
The distance is measured between the initial position and the farthest side of the box from it.
farthest-corner
The distance is measured between the initial position and the farthest corner of the box from it.

Note: When the initial position is at one of the corners of the containing block, the closest side takes the edge where the initial position is on. Even if the offset given by <length> or <percentage> changes, the position of the element specified with closest-side is the same.

See the section Motion processing for how to process a motion position.

This example shows a way to align elements within the polar coordinate system using offset-path, offset-distance and offset-position.
<body>
  <div id="circle1"</div>
  <div id="circle2"</div>
  <div id="circle3"</div>
</body>
<style>
    #circle1 {
       offset-path: 0deg;
       offset-distance: 50%;
    }
    #circle2 {
       offset-path: 90deg;
       offset-distance: 20%;
    }
    #circle3 {
       offset-path: 225deg;
       offset-distance: 100%;
    }
</style>
An image of three elements positioned to polar coordinates
An example of positioning element in polar coordinates

7.4. The anchor of the element: The offset-anchor property

Name: offset-anchor
Value: <position>
Initial: auto
Applies to: all elements
Inherited: no
Percentages: Relative to width and height of an element
Media: visual
Computed value: as specified
Canonical order: per grammar
Animatable: as <position>

Defines an origin of the element in the path. The origin specifies a position which is a representative point of the element and could be set as any point within a content area of the element. The element’s point of origin is placed along the path.

Values have the following meanings:

auto
Computes to the value from offset-position. When auto is given to offset-anchor, offset-position behaves similar to background-position.
<position>
<percentage>
A percentage for the horizontal offset is relative to width of content box area of the element. A percentage for the vertical offset is relative to height of content box area of the element. For example, with a value pair of '100%, 0%', an anchor point is on the upper right corner of the element.
<length>
A length value gives a length offset from the upper left corner of the element’s content area.
The following explains how to set the origin of the element.
#plane {
    offset-anchor: center;
}

The red dot in the middle of the shape indicates the origin of the shape.

Shape with its origin
A red dot in the middle of a plane shape indicates the shape’s origin.
This example shows an alignment of four elements with different origin points.
<style>    
    #item1 {
        offset-path: 45deg;
        offset-distance: 100%;
        offset-anchor: right top;
    }
    #item2 {
        offset-path: 135deg;
        offset-distance: 100%;
        offset-anchor: right bottom;
    }
    #item3 {
        offset-path: 225deg;
        offset-distance: 100%;
        offset-anchor: left bottom;
    }
    #item4 {
        offset-path: 315deg;
        offset-distance: 100%;
        offset-anchor: left top;
    }
</style>
<body>
    <div id="item1"></div>
    <div id="item2"></div>
    <div id="item3"></div>
    <div id="item4"></div>
</body>
An example of offset-anchor
An example of offset-anchor

How can the margin be applied to an element when polar-origin: 50% 50% and polar-anchor: 50% 50%?
Which would be a base point for applying it between the upper left corner or center of a containing block? With the former, the position of the element changes when the value of the margin changes, while with the latter, the margin value doesn’t affect the position of the element.

7.5. Rotation at point: The offset-rotation property

Name: offset-rotation
Value: [ auto | reverse ] || <angle>
Initial: 0
Applies to: All elements. In SVG, it applies to container elements excluding the defs element and all graphics elements
Inherited: no
Percentages: n/a
Media: visual
Computed value: as specified
Canonical order: per grammar
Animatable: yes

Defines the direction of the element while positioning along the motion path.

Values have the following meanings:

auto
Indicates that the object is rotated (over time if motion-offset is animated) by the angle of the direction (i.e., directional tangent vector) of the path. If specified in combination with <angle>, the computed value of <angle> is added to the computed value of auto.
reverse

Indicates that the object is rotated (over time if motion-offset is animated) by the angle of the direction (i.e., directional tangent vector) of the path plus 180 degrees. If specified in combination with <angle>, the computed value of <angle> is added to the computed value of reverse.

This is the same as specifying auto 180deg.

<angle>
Indicates that the element has a constant rotation transformation applied to it by the specified rotation angle. See definitions of auto or reverse if specified in combination with either one of the keywords. For the purpose of this argument, 0deg points to the direction of the positive y-axis, and positive angles represent clockwise rotation, so 90deg point toward the direction of the positive x-axis.

Between the direction of the positive y-axis and that of the positive x-axis, which 0deg' indicates? In mathematical theory, 0deg is commonly defined as the positive direction of the x-axis, but <angle> value in [CSS3VAL] specifies it as upper or north side on the screen.

Note: The rotation described here does not override or replace any rotation defined by the transform property.

When the shape’s point of origin is placed at different positions along the path and offset-rotation isn’t specified, the shape points to the positive direction of the x-axis.

Path without rotation
A black plane at different positions on a blue dotted path without rotation transforms.

This shows an example when the offset-rotation property is set to auto. The shape is rotated based on the gradient at the current position and faces the direction of the path at this position.

Path with auto rotation
A black plane at different positions on a blue dotted path, rotated in the direction of the path.

This example is when the offset-rotation property is set to reverse. The plane faces the opposite direction of the path at each position on the path.

Path with reverse auto rotation
A black plane at different positions on a blue dotted path, rotated in the opposite direction of the path.

The last example sets the offset-rotation property to 45deg. The shape is rotated by 45 degree once and keeps the rotation at each position on the path.

Path with fixed rotation
A black plane at different positions on a blue dotted path, rotated by a fixed amount of degree.
This example shows how auto or reverse works specified in combination with <angle>. The computed value of <angle> is added to the computed value of auto or reverse.
<style>
    body {
        border-radius: 50%;
    }
    #item1 {
        offset-path: 0deg;
        offset-distance: 90%;
        offset-rotate: auto 90deg;
  }
    #item2 {
        offset-path: 45deg;
        offset-distance: 90%;
        offset-rotate: auto 90deg;
    }
    #item3 {
        offset-path: 135deg;
        offset-distance: 90%;
        offset-rotate: auto -90deg;
    }
    #item4 {
        offset-path: 180deg;
        offset-distance: 90%;
        offset-rotate: auto -90deg;
    }
    #item5 {
        offset-path: 225deg;
        offset-distance: 90%;
        offset-rotate: auto -90deg;
    }
    #item6 {
        offset-path: -45deg;
        offset-distance: 90%;
        offset-rotate: auto 90deg;
    }
</style>
<body>
  <div id="item1">1</div>
  <div id="item2">2</div>
  <div id="item3">3</div>
  <div id="item4">4</div>
  <div id="item5">5</div>
  <div id="item6">6</div>
</body>
An image of example for offset-rotation
The elements are rotated by the value of auto with a fixed amount of degree.

7.6. Position processing

7.6.1. Calculating the computed distance along a path

Processing the distance along a path operates differently depending upon whether the path is open or closed:

To determine the computed distance for a given path and distance:

  1. Let the total length be the total length of path with all sub-paths.

  2. If distance is a length:

    Let upper bound be equal to the total length.

    Otherwise:

    Let upper bound be equal to 100%.

  3. If path is a closed path:

    Let computed distance be equal to distance modulus upper bound.

    Otherwise:

    Let computed distance be equal to distance clamped by 0 and upper bound.

7.6.2. Calculating the path transform

  1. Let path be the geometry of the specified basic shape, path or SVG shape element reference.

  2. Let distance be the computed value of offset-distance.

  3. If path is a valid path:

    1. Determine the computed distance by invoking the process for Calculating the computed distance along a path on path and distance.

    2. Let position be the coordinate pair at computed distance along path.

    3. Create the supplemental transformation matrix transform to the local coordinate system of the element.

    4. Translate transform by position.

    5. Let rotate be the computed value of offset-rotation.

    6. Post-multiply the rotation rotate to transform.

    7. Post-multiply transform to the local coordinate system of the element.

8. Use Cases

Use cases are described on these.

9. Changes

9.1. Changes from September 22th 2015 version

Acknowledgements

This specification is made possible by input from Dong-Young Lee, Soonbo Han, Florian Rivoal, Joone Hur, Kang-Soo Seo, Sangjo Park, Woojun Jung, Chisoon Jeong, Yunbum Sung, Alan Stearns, Brad Kemper, and the CSS Working Group members. Thanks also to Adenilson Cavalcanti for editorial input.

Conformance

Document conventions

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.

Advisements are normative sections styled to evoke special attention and are set apart from other normative text with <strong class="advisement">, like this: UAs MUST provide an accessible alternative.

Conformance classes

Conformance to this specification is defined for three conformance classes:

style sheet
A CSS style sheet.
renderer
A UA that interprets the semantics of a style sheet and renders documents that use them.
authoring tool
A UA that writes a style sheet.

A style sheet is conformant to this specification 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 this specification if, in addition to interpreting the style sheet as defined by the appropriate specifications, it supports all the features defined by this specification 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 this specification 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.

Requirements for Responsible Implementation of CSS

The following sections define several conformance requirements for implementing CSS responsibly, in a way that promotes interoperability in the present and future.

Partial Implementations

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 property 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.

Implementations of Unstable and Proprietary Features

To avoid clashes with future stable CSS features, the CSSWG recommends following best practices for the implementation of unstable features and proprietary extensions to CSS.

Implementations of CR-level Features

Once a specification reaches the Candidate Recommendation stage, implementers should release an unprefixed implementation of any CR-level feature they can demonstrate to be correctly implemented according to spec, and should avoid exposing a prefixed variant of that feature.

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 public-css-testsuite@w3.org mailing list.

Index

Terms defined by this specification

Terms defined by reference

References

Normative References

[CSS-BACKGROUNDS-3]
CSS Backgrounds and Borders Module Level 3 URL: https://drafts.csswg.org/css-backgrounds-3/
[CSS-CASCADE-4]
Elika Etemad; Tab Atkins Jr.. CSS Cascading and Inheritance Level 4. 14 January 2016. CR. URL: http://dev.w3.org/csswg/css-cascade/
[CSS-COLOR-4]
Tab Atkins Jr.; Chris Lilley. CSS Color Module Level 4. 5 July 2016. WD. URL: https://drafts.csswg.org/css-color/
[CSS-CONDITIONAL-3]
CSS Conditional Rules Module Level 3 URL: https://drafts.csswg.org/css-conditional-3/
[CSS-CONTAINMENT-3]
CSS Containment Module Level 3 URL: https://drafts.csswg.org/css-containment-3/
[CSS-DEVICE-ADAPT]
Rune Lillesveen; Florian Rivoal; Matt Rakow. CSS Device Adaptation Module Level 1. 29 March 2016. WD. URL: https://drafts.csswg.org/css-device-adapt/
[CSS-IMAGES-3]
CSS Image Values and Replaced Content Module Level 3 URL: https://drafts.csswg.org/css-images-3/
[CSS-MASKING-1]
Dirk Schulze; Brian Birtles; Tab Atkins Jr.. CSS Masking Module Level 1. 26 August 2014. CR. URL: http://dev.w3.org/fxtf/css-masking-1/
[CSS-SHAPES-1]
Vincent Hardy; Rossen Atanassov; Alan Stearns. CSS Shapes Module Level 1. 20 March 2014. CR. URL: http://dev.w3.org/csswg/css-shapes/
[CSS21]
Bert Bos; et al. Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification. 7 June 2011. REC. URL: https://www.w3.org/TR/CSS2
[CSS3-POSITIONING]
Rossen Atanassov; Arron Eicholz. CSS Positioned Layout Module Level 3. 17 May 2016. WD. URL: https://drafts.csswg.org/css-position/
[CSS3VAL]
Tab Atkins Jr.; Elika Etemad. CSS Values and Units Module Level 3. 11 June 2015. CR. URL: http://dev.w3.org/csswg/css-values/
[MOTION-1]
Dirk Schulze; Shane Stephens. Motion Path Module Level 1. 9 April 2015. WD. URL: http://dev.w3.org/fxtf/motion-1/
[RFC2119]
S. Bradner. Key words for use in RFCs to Indicate Requirement Levels. March 1997. Best Current Practice. URL: https://tools.ietf.org/html/rfc2119
[SVG11]
Erik Dahlström; et al. Scalable Vector Graphics (SVG) 1.1 (Second Edition). 16 August 2011. REC. URL: https://www.w3.org/TR/SVG11/
[SVG2]
Nikos Andronikos; et al. Scalable Vector Graphics (SVG) 2. 15 September 2015. WD. URL: https://svgwg.org/svg2-draft/

Informative References

[CSS-TRANSFORMS-1]
Simon Fraser; et al. CSS Transforms Module Level 1. 26 November 2013. WD. URL: http://dev.w3.org/csswg/css-transforms/
[CSS3-BORDER]
Tapas Roy. CSS3 module: Border. 7 November 2002. WD. URL: https://www.w3.org/TR/css3-border
[CSS3COLOR]
Tantek Çelik; Chris Lilley; David Baron. CSS Color Module Level 3. 7 June 2011. REC. URL: https://www.w3.org/TR/css3-color
[MEDIAQUERIES-4]
Florian Rivoal; Tab Atkins Jr.. Media Queries Level 4. 6 July 2016. WD. URL: https://drafts.csswg.org/mediaqueries-4/

Property Index

Name Value Initial Applies to Inh. %ages Media Ani­mat­able Anim­ation type Canonical order Com­puted value
shape-inside auto | outside-shape | [ <basic-shape> || shape-box ] | <image> | display auto block-level elements no n/a visual as specified for <basic-shape>, otherwise no per grammar computed lengths for <basic-shape>, the absolute URI for <uri>, otherwise as specified
border-boundary none | parent | display none all elements yes n/a visual discrete per grammar as specified
offset-path <url> | <angle> && contain? | [ <basic-shape> | <path()> ] || <geometry-box> | none 0deg for <angle>, otherwise no All elements. In SVG, it applies to container elements excluding the defs element and all graphics elements no N/A visual as specified for angle, otherwise no per grammar as specified
offset-position auto | <position> auto all elements no Refer to the size of containing block visual as position per grammar as specified
offset-distance [ <length> | <percentage> <size>? ] 0 all elements no Refer to the total length of the path visual yes per grammar as specified
offset-anchor <position> auto all elements no Relative to width and height of an element visual as <position> per grammar as specified
offset-rotation [ auto | reverse ] || <angle> 0 All elements. In SVG, it applies to container elements excluding the defs element and all graphics elements no n/a visual yes per grammar as specified

@media Descriptors

Name Value Initial Type
shape rect | round discrete

@viewport Descriptors

Name Value Initial Computed value Media Percentages
viewport-fit auto | contain | cover auto as specified visual, continuous N/A

Issues Index

What if content overflows? Clipping or scrolling?
How can the margin be applied to an element when polar-origin: 50% 50% and polar-anchor: 50% 50%?
Which would be a base point for applying it between the upper left corner or center of a containing block? With the former, the position of the element changes when the value of the margin changes, while with the latter, the margin value doesn’t affect the position of the element.
Between the direction of the positive y-axis and that of the positive x-axis, which 0deg' indicates? In mathematical theory, 0deg is commonly defined as the positive direction of the x-axis, but <angle> value in [CSS3VAL] specifies it as upper or north side on the screen.