CARVIEW |
CSS Round Display Level 1
W3C First Public Working Draft,
- This version:
- https://www.w3.org/TR/2015/WD-css-round-display-1-20150922/
- Latest version:
- https://www.w3.org/TR/css-round-display-1/
- Editor's Draft:
- https://drafts.csswg.org/css-round-display/
- Feedback:
- www-style@w3.org with subject line “[css-round-display] … message topic …” (archives)
- Issue Tracking:
- GitHub
- Inline In Spec
- Editors:
- Hyojin Song (LG Electronics)
- Jihye Hong (LG Electronics)
- Former Editors:
-
- Soonbo Han (LG Electronics)
Copyright © 2015 W3C® (MIT, ERCIM, Keio, Beihang). W3C liability, trademark and document use rules apply.
Abstract
This document describes CSS extensions to support a round display. It extends existing CSS features including Media Queries[MEDIAQUERIES-4], CSS Shapes[CSS-SHAPES-1], Borders[CSS3-BORDER], and Positioned Layout[CSS3-POSITIONING]. The extensions will 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 section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the W3C technical reports index at https://www.w3.org/TR/.
This document is a First Public Working Draft.
Publication as a First Public Working Draft does not imply endorsement by the W3C Membership. This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress.
The (archived) public mailing list www-style@w3.org (see instructions) is preferred for discussion of this specification. When sending e-mail, please put the text “css-round-display” in the subject, preferably like this: “[css-round-display] …summary of comment…”
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.
Table of Contents
1. Introduction
Everything on the web is a rectangle. For example, 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. New devices with a round display are now emerging. The current web standards lack some features to support the devices as follows:
- Lack of the capability to detect a round display
- Lack of layout mechanisms suitable for a round display
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, we add the device-radius media feature to Media Queries. The feature 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. We also add the border-boundary property to CSS Borders and introduce polar positioning for a better web design suitable for a round display.
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 device-radius media feature to support a round display. This will allow web authors to apply different styles to a web page on the rounded display.
3.1. The device-radius 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. The device-radius media feature describes the property of rounded borders of a display.<link media="screen and (device-radius: 0%)" rel="stylesheet" href="rectangle.css" /> <link media="screen and (device-radius: 50%)" rel="stylesheet" href="round.css" />
By the mechanism of media queries, if the value of the device-radius media feature is less than 50%, 'rectangle.css
' is applied. If it is 50%, 'round.css
' is applied.
As in the 'border-radius
' property, the device-radius media feature can describe various round shapes of displays, such as rectangle, regular circle, ellipse, and rectangle with round corners.
Name: | device-radius |
---|---|
For: | @media |
Value: | [ <length> | <percentage> ] |
Percentage: | Refer to corresponding dimension of the display |
Type: | range |
Note: To define a 'range
' type media feature, the feature may be written as a normal media feature, but with a 'min-
' or 'max-
' prefix on the feature name. 'min-
' or 'max-
' prefixes express 'greater or equal to' or 'smaller or equal to' constraints respectively.
The length or percentage value of the 'device-radius
' property defines a radius of a quarter ellipse in terms of the shape of the corner of the outer screen edge (This is similar to the 'border-radius
' property. See the border-radius description). If the length is zero, the shape of screen is a rectangle, otherwise it is a rectangle with rounded corners or a regular circle. A percentage value of the 'device-radius
' is proportional to the diameter of the screen. If the screen shape is the regular circle, 'device-radius
': 50% has a true value, because a half of the diameter of the regular circle is the radius of the screen shape. A negative value is not allowed.
<!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>

(A) Rectangle Display

(B) Round Display
Devices where the device-radius media feature is not applicable
<!-- index.html --> <head> <link media="screen and (device-radius: 0%)" rel="stylesheet" href="rectangle.css" /> <link media="screen and (device-radius: 50%)" rel="stylesheet" href="round.css" /> </head>
If this example code is loaded in a regular round display, 'round.css
' will be applied by the media queries mechanism. To render the clock properly, 'round.css
' could be written as follows.
#clockLayer { border-radius: 50%; } #clockInset { border-radius: 50%; } #date { text-align: center; } ...

(A) Rectangle Display
(w/ device-radius: 0%
)

(B) Round Display
(w/ device-radius: 50%
)
Devices where the device-radius media feature is applicable
Note: If the shapes of displays are various, such as polygons, we need to extend the media features more 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.
Using device-radius with just a single value (e.g. device-radius: 50%) is enough (for simplicity)? Otherwise, do we need to support all possible values the same as border-radius?
4. Aligning content along the display border
4.1. The shape-inside property
CSS Shapes [CSS-SHAPES-2] 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 could sometimes be hard to specify the wrapping area identical to the shape of a display. Thus, we add a new value 'display
' to the shape-inside property to facilitate it. When the shape-inside property on an element is set to 'display
', its content (or contained element) is 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 |
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) Without 'shape-inside
'

(B) With 'shape-inside: display
'
Align the content along the display border
Even though the shape of the rounded display could be described by circle() or ellipse() as <basic-shape>, 'shape-inside: display' is useful that authors make contents to be aligned within the display edge conveniently. In case of complicated shaped displays like curved, stelliform, or polygonal shape, the availability of 'shape-inside: display' is more increased in comparison with a simple shaped display (e.g. regular rounded display).
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.

Align a part of the content along the display border
What if content overflows? Clipping or scrolling?
5. Drawing borders around the display border
5.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 |
Animatable: | no |
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.
<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>

(A) Without 'border-boundary
'

(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.
6. Positioning content by using the polar coordinate system
Polar coordinate system is a two-dimensional coordinate system that describes the position of a point in a plane with a distance from a reference point and an angle from a reference direction. Elements could be placed along a circle or concentric circles, and the polar coordinate system is useful to handle such cases.
This section introduces polar positioning to support layout of elements in the polar coordinate system where the position of an element is determined by a distance from the center point within the containing element and an angle from the Y-axis.
We add 'polar
' to the value of the position property to support the polar coordinates of an element itself. The polar-angle and polar-distance properties specify the position of an element.
Note: In the polar coordinate system, a point is described as being a certain distance from the pole and a certain angle from the polar axis. In the 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 polar-angle value of an element is 0, the element is positioned on the y-axis. If the angle value of an element increases in the positive direction from 0, the element moves clockwise. The method to determine a direction using polar-angle works the same way in [CSS-VALUES], <angle> value.
6.1. The position property
When the position property on an element is set to 'polar
', the element could be affected in polar coordinate system.
Name: | position |
---|---|
Value: | static | relative | absolute | sticky | fixed | polar
|
Initial: | static |
Applies to: | all elements except table-column-group and table-column |
Inherited: | no |
Percentages: | N/A |
Media: | visual |
Computed value: | specified value |
Animatable: | no |
Note: The center point of the containing block of an element indicates the origin of polar coordinate when the value of position property of the element is 'polar
'.
In conventional coordinate system used in the web, the origin is positioned in the upper left corner of a containing block. In comparison, the origin of polar coordinates is the center point of a containing block. Therefore different methods are required to deploy and transform elements, or set margin/padding values when using polar coordinates.
An example as below shows the difference between the conventional coordinates and the polar coordinates when positioning elements.
Figure 6A might be the result of
<body> <div style="position: absolute; width: 100px; height: 100px; background-color: blue;"></div> <div style="position: absolute; width: 50px; height: 50px; background-color: green;"></div> </body>
Figure 6B might be the result of
<body> <div style="position: polar; width: 100px; height: 100px; background-color: blue;"></div> <div style="position: polar; width: 50px; height: 50px; background-color: green;"></div> </body>

(A) With 'position: absolute
'

(B) With 'position: polar
'
Positioning elements in conventional coordinate system and polar coordinate system
6.2. The polar-angle property
The polar-angle property specifies the angle from the Y-axis. This property is activated on condition of position: polar.Name: | polar-angle |
---|---|
Value: | <angle> |
Initial: | 0 |
Applies to: | all elements |
Inherited: | no |
Percentages: | N/A |
Media: | visual |
Computed value: | as specified |
Animatable: | as angle |
6.3. The polar-distance property
The polar-distance property specifies the distance from the center of the containing block. This property is activated on condition of position: polar.Name: | polar-distance |
---|---|
Value: | [ <length> | <percentage> ] |
Initial: | 0 |
Applies to: | all elements |
Inherited: | no |
Percentages: | relative to distance from center to edge of containing block |
Media: | visual |
Computed value: | as specified |
Animatable: | as length, percentage, or calc |
<body> <div id="circle1" style="position: polar; polar-angle: 0deg; polar-distance: 50%"></div> <div id="circle2" style="position: polar; polar-angle: 90deg; polar-distance: 20%"></div> <div id="circle3" style="position: polar; polar-angle: 225deg; polar-distance: 100%"></div> </body>

An example of polar positioning
How to rotate the element itself with an axis from the element position to the central point of containing block? Is new property needed to support that at one time in polar coordinate system?
How to position items to the edge of the containing block without overflowing it? (polar-anchor could be suggested)
One of the profits of polar coordinate system is performance improvement. The significant performance improvement can be seen in animation using the polar coordinates. How to define animation in the polar coordinates? Is there any difference between the conventional coordinates and the polar coordinates when animate elements?
By polar-distance property, a position of an element is specified based on the containing block’s center. In other way, is the method of positioning elements by the distance based on the edge of the containing block needed?
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:
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.
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 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.
Experimental implementations
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.
Non-experimental implementations
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 https://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
- border-boundary, in §5.1
- device-radius, in §3.1
- polar-angle, in §6.2
- polar-distance, in §6.3
- position, in §6.1
- shape-inside, in §4.1
Terms defined by reference
- [css-backgrounds-3] defines the following terms:
- [css-conditional-3] defines the following terms:
- [css-images-3] defines the following terms:
- [CSS-SHAPES-2] defines the following terms:
- [css-values] defines the following terms:
- [CSS21] defines the following terms:
References
Normative References
- [CSS-SHAPES-2]
- Rossen Atanassov; Alan Stearns. CSS Shapes Module Level 2. Proposal for a CSS module. (Retrieved 21 Sep 2015). URL: https://drafts.csswg.org/css-shapes-2/
- [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
- [CSS-BACKGROUNDS-3]
- CSS Backgrounds and Borders Module Level 3 URL: https://www.w3.org/TR/css3-background/
- [CSS-CONDITIONAL-3]
- CSS Conditional Rules Module Level 3 URL: https://www.w3.org/TR/css3-conditional/
- [CSS-IMAGES-3]
- CSS Image Values and Replaced Content Module Level 3 URL: https://www.w3.org/TR/css3-images/
- [CSS-VALUES]
- Tab Atkins Jr.; Elika Etemad. CSS Values and Units Module Level 3. 11 June 2015. CR. URL: https://www.w3.org/TR/css-values/
- [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
Informative References
- [CSS-SHAPES-1]
- Vincent Hardy; Rossen Atanassov; Alan Stearns. CSS Shapes Module Level 1. 20 March 2014. CR. URL: https://www.w3.org/TR/css-shapes-1/
- [CSS3-BORDER]
- Tapas Roy. CSS3 module: Border. 7 November 2002. WD. URL: https://www.w3.org/TR/css3-border
- [CSS3-POSITIONING]
- Rossen Atanassov; Arron Eicholz. CSS Positioned Layout Module Level 3. 3 February 2015. WD. URL: https://www.w3.org/TR/css3-positioning/
- [MEDIAQUERIES-4]
- Florian Rivoal; Tab Atkins Jr.. Media Queries Level 4. 5 June 2014. WD. URL: https://www.w3.org/TR/mediaqueries-4/
Property Index
Name | Value | Initial | Applies to | Inh. | %ages | Media | Animatable | Computed 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 | 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 | no | as specified |
position | static | relative | absolute | sticky | fixed | polar | static | all elements except table-column-group and table-column | no | N/A | visual | no | specified value |
polar-angle | <angle> | 0 | all elements | no | N/A | visual | as angle | as specified |
polar-distance | [ <length> | <percentage> ] | 0 | all elements | no | relative to distance from center to edge of containing block | visual | as length, percentage, or calc | as specified |
@media Descriptors
Name | Value | Initial | Percentage | Type |
---|---|---|---|---|
device-radius | [ <length> | <percentage> ] | Refer to corresponding dimension of the display | range |