1. Introduction
This section is not normative.
As evidenced by the extraordinary variety of designs found on the web, CSS is a very expressive language, capable of describing unlimited styles and layouts. However, one of the design goal of CSS was also to make it easy to learn and to read by people. Making it simple for untrained authors to read and guess the meaning of a style sheet after only a basic introduction to CSS has contributed greatly to the success of the language.
In addition, easy-to-read style sheets are also easier to maintain.
In this spirit, this specification introduces a few new values and units, which, while not bringing significant new capabilities to the web platform, makes it possible to write style sheets that are easier to read than ever before, by enabling authors to use values and units that are familiar and appropriate for the domain they are working on.
1.1. Module Interactions
This module extends:
- the data type definitions in [CSS3-VALUES]
- the <gradient> definition in [CSS4-IMAGES]
- the voice-rate property in [CSS3SPEECH]
- the '@media' rule in [MEDIAQUERIES-5]
1.2. Value Definitions
This specification follows the CSS property definition conventions from [CSS2] using the value definition syntax from [CSS3-VALUES]. Value types not defined in this specification are defined in CSS Values & Units [CSS3-VALUES]. Combination with other CSS modules may expand the definitions of these value types.
In addition to the property-specific values listed in their definitions, all properties defined in this specification also accept the CSS-wide keywords as their property value. For readability they have not been repeated explicitly.
2. Extended Units
CSS provides several absolute length units such as cm or in, as well as several <time> units such as s or ms They can all be converted between each other at fixed ratios, but are nonetheless provided in recognition that it is most convenient for authors to use units that they are most familiar with, or that some designs are more naturally expressed in some units than others.2.1. Astronomical units
This specification adds four absolute length units which should be appreciated by authors in fields such as astronomy and fundamental physics. The new units are ls, pc and their sub multiples pls and apc. They are defined as physical units.unit | name | equivalence |
---|---|---|
apc | attoparsec | 1 apc = 3.086 cm |
pls | picolightsecond | 1 pls = 1.133 px |
ls | lightsecond | 1 ls = 1012 pls |
pc | parsec | 1 pc = 1018 apc |
Note: Lightsecond was chosen instead of the more familiar lightyear to make sure that layouts computed during leap years would be unambiguously identical to those computed during non-leap years.
Note: This specification does not address relativistic effects of scrolling or animations and transitions at (or beyond) the speed of light.
< div id = space > < div class = celestial-body id = sun data-color = yellow data-radius = 2.3ls > < div class = celestial-body id = mercury data-color = lightgray data-radius = 0.0081ls data-semimajor-axis = 193ls data-orbital-period = 6.278ftn ></ div > < div class = celestial-body id = venus data-color = #FFD881 data-radius = 0.020ls data-semimajor-axis = 361ls data-orbital-period = 16.05ftn ></ div > < div class = celestial-body id = earth data-color = blue data-radius = 0.021ls data-semimajor-axis = 499ls data-orbital-period = 26.09ftn > < div class = celestial-body id = moon data-color = #E0E0E0 data-radius = 0.0057ls data-semimajor-axis = 1.28ls data-orbital-period = 2.109ftn ></ div > </ div > < div class = celestial-body id = mars data-color = #AD674D data-radius = 0.011ls data-semimajor-axis = 760ls data-orbital-period = 49.07ftn ></ div > </ div ></ div > < style > #space
{ background : black; overflow : hidden; position : relative; } .celestial-body{ position : absolute; left : 50 % ; top : 50 % ; border-radius : 50 % ; border-style : solidattr ( data-radius length, 0 ) attr ( data-color color, white); margin : calc ( -1 *attr ( data-radius length, 0 )); transform-origin : attr ( data-radius length, 0 ) calc ( attr ( data-radius length, 0 ) +attr ( data-semimajor-axis length, 0 )); animation : orbit linear infiniteattr ( data-orbital-period time, 0 ); } @keyframes orbit{ from{ transform : translateY ( calc ( attr ( data-semimajor-axis length, 0 ) *-1 )) rotate ( 0 ); } to{ transform : translateY ( calc ( attr ( data-semimajor-axis length, 0 ) *-1 )) rotate ( -360 deg ); } }
</ style >
The following is a disappointingly small sample rendering (not at scale) of what this would look like. With the new units and more space than this specification can offer, this would instead be overwhelmingly awesome.
2.2. Traditional time units
While the s and ms units defined in [CSS3-VALUES] are appropriate for very short durations, their use to express longer time spans is inadequate. Moreover, authors may sometimes wish to use less dry terminology and prefer more expressive and vivid language. This specification therefore introduces two <time> units: ftn and its subdivision mftn.
unit | name | equivalence |
---|---|---|
ftn | Fortnight | 1 ftn = 1209600 s |
mftn | Millifortnight | 1 ftn = 1000 mftn |
2.3. Speech rate
This specification introduces an new dimension, together with a new unit to be used with this dimension. The <speech-rate> described the speed at which a text is read aloud. It can be expressed using the tmbl unit, as defined below.
unit | name | definition |
---|---|---|
tmbl | Timble | This is the rate of speech of Sir Tim Berners-Lee when delivering a speech. |
Note: Authors are advised to be cautious when using this unit, as it can easily lead to rates of speech that are too high for the listener to follow. 1tmbl is generally considered to be about the maximum rate a listener without special training can sustainably understand while paying close attention. Consider reducing the speed when the audience is distracted, tired, or comprises many non-native speakers. These factors are cumulative. For dictation or during meetings for which live minutes are taken, a rate of 0.3tmbl is more appropriate.
For languages other than English, should 1tmbl be defined as
the same number of words per minute as 1tmbl in English?
This seems problematic as we do not have a precise definition for word,
and because average word length can vary significantly per language.
Alternatively, defining 1tmbl as
the speed at which Tim Berners-Lee speaks in that language
is also problematic,
given that there are languages that He does not speak at all.
Tim Berners-Lee has provided an alternative definition of the timble, as documented by Doug Schepers: speech at more than 1 timble is difficult to understand;
speech below 1 timble is simply boring
.
Doug himself defines it as the uppermost rate of speech
at which a normal person
can understand what’s being said in their native language
.
2.3.1. Extension to the voice-rate property
This specification extends the voice-rate property, so that the tmbl unit can be used.
Name: | voice-rate |
---|---|
New values: | [normal | x-slow | slow | medium | fast | x-fast | <speech-rate>] || <percentage> |
Should negative values be allowed for <speech-rate> for reversed speech?
2.4. Device performance
This specification introduces an new dimension, together with a new unit to be used with this dimension.
The <device-performance> describes the performance of the current device and user agent combination. It can be expressed using the adafish unit, as defined below.
unit | name | definition |
---|---|---|
adafish | Adafish | This is the maximum number of fish that can be displayed on the current device and user agent combination in Ada Rose Cannon’s Fish Garden without the user agent dropping any frames. |
Note: Ada Rose Cannon’s Fish Garden supports changing the number of fish through the `?fish=` query parameter, e.g. this link will show 50 fish
2.4.1. Extension to the @media rule: The performance feature
Name: | performance |
---|---|
For: | @media |
Value: | <device-performance> |
Type: | range |
The performance media feature describes the performance characteristics of the current device and user agent combination at the current time. It SHOULD incorporate transient and permanent environmental factors affecting performance such as the current room temperature, the accumulation of dust in the device’s cooling system, and the existence of spilled lemonade or coffee on the device’s motherboard.
When querying the performance feature the user agent SHOULD ensure that it is querying a recent value. The user agent MAY in the background run Ada’s Fish Garden with various parameters to estimate this value. If device performance characteristics change while content is being viewed, the user agent MUST recompute its value for performance, potentially restyling the document.
@media ( min-performance: 1000 adafish ) {
#very-cool-demo-with-blinky-lights {
display : block;
}
}
@media ( max-performance: 1000 adafish ) {
#really-bad-demo-with-no-blinky-lights-whatsoever {
display : block;
}
}
2.4.2. Fingerprinting concerns
This API may be used for gleaning information about the user’s environment, which may be used to fingerprint them. This is recognized to be an acceptable loss for the momentous benefits this API is expected to provide the web platform.
3. Double Rainbow
<gradient> allows sophisticated visual effects, but they are tedious to write, review and maintain as non trivial gradients cannot easily be visualized by merely reading the source. This specification introduces a new syntax to describe a particular kind of <radial-gradient()>: double rainbows. This spectacular visual effect which would improve most web pages is currently underused due to the difficulty of specifying it correctly.
The <gradient> syntax is extended to accept <double-rainbow()> in addition to the other values defined in [CSS4-IMAGES]
double-rainbow() = double-rainbow( <position> [, [ <extent> | <length-percentage [0,∞]>]]? ) <extent> = closest-corner | closest-side | farthest-corner | farthest-side
<length> or <percentage> gives the radius of the outermost circle of the double rainbow explicitly. Percentages values are relative to the corresponding dimension of the gradient box. Negative values are invalid.
If the second argument is omitted, the default value is farthest-side.
By combining double-rainbow() with about:unicorn [FETCH], modern web standards can be used to achieve a similar effect.
< img src = "about:unicorn"
style = "background: double-rainbow(bottom, closest-corner)" >
Acknowledgments
Thanks especially to the following people for their ideas, feedback, and experimental implementations (in alphabetical order by first name): Anne van Kesteren, Bruce Lawson, Chris Mills, Doug Schepers, Daniel Glazman, Leif Arne Storset, Paul Verbeek, Peter Linss, Tim Berners-Lee (assuming the quotation by Doug correctly records what Tim said).