Skip to content

Commit f86e276

Browse files
committed
[css-egg-1] Added random units
1 parent 914ce4b commit f86e276

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

css-egg-1/Overview.bs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,37 @@ This feature is useful for designing robust content that adapts to different dev
430430

431431
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.
432432

433+
<h3 id="random">Random values</h3>
434+
435+
[[CSS-VALUES-5]] introduces ''random()'' to generate random values.
436+
437+
As that function has very limited use cases,
438+
this specification introduces three <dfn>random value units</dfn> covering a broader range of randomness.
439+
440+
<table class="data" export>
441+
<thead>
442+
<tr><th>unit
443+
<th>name
444+
<th>definition
445+
<tbody>
446+
<tr><th><dfn style="white-space: nowrap">🎲</dfn>
447+
<td>Random number
448+
<td>Returns a random <<number>> value between ''0'' and the given <<number>> value.
449+
<tr><th><dfn style="white-space: nowrap">🎲🎲</dfn>
450+
<td>Random number and unit
451+
<td>Returns a random <<dimension>> or <<percentage>> between ''0'' and the given value.
452+
<tr><th><dfn style="white-space: nowrap">❓</dfn>
453+
<td>Random value
454+
<td>Returns a <<number>>, <<dimension>>, or <<percentage>> between ''0'' and the given value,
455+
a <<color>>, <<string>>, or any kind of <a href="https://drafts.csswg.org/css-values-4/#keywords">pre-defined keyword</a>.
456+
<tr><th><dfn style="white-space: nowrap">🎁</dfn>
457+
<td>Complete randomness
458+
<td>May return any kind of value defined in [[CSS-VALUES-5]],
459+
including but not limited to <<number>>, <<dimension>>, or <<percentage>> values of any size,
460+
a <<color>>, <<string>>, any kind of <<ident>>, or nothing at all.
461+
It might even come up with new values not yet defined. Who knows?
462+
</table>
463+
433464

434465
<h2 id="rainbow">
435466
Double Rainbow</h2>

0 commit comments

Comments
 (0)