forked from w3c/csswg-wiki
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathradial-gradient-readability.txt
More file actions
180 lines (157 loc) · 7.12 KB
/
radial-gradient-readability.txt
File metadata and controls
180 lines (157 loc) · 7.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
===== Radial Gradient Readability =====
We've agreed that radial gradients should have a literate syntax. Linear gradients already kinda have one, in a simple way, and hopefully radials should end up thematically consistent.
==== Latest Proposal ====
* for CSS3: ''radial-gradient([ <extent> || <shape> ] at <position>, <colors>)''
* for CSS4: ''radial-gradient([ <extent> || <shape> ] at <position> [from <position> | from-offset <length>{1,2}], <colors>)''
Because the default size is ''cover'', this means:
* ''radial-gradient(from 25% 25%, <colors>)'' makes the 0% color at 25% 25%, and the 100% color is at a box-centered box-covering ellipse.
* ''radial-gradient(at 25% 25%, <colors>)'' makes the 0% color at 25% 25%, and the 100% color at a 25% 25%-centered box-covering ellipse.
<html><a href="data:text/html;charset=utf-8,<!DOCTYPE%20html>%0A<div><%2Fdiv>%0A<div>%0A<style>%0Adiv%20%7B%20%0Awidth%3A%20200px%3B%0Aheight%3A%20200px%3B%0Aborder%3A%20thin%20solid%3B%0Afloat%3A%20left%3B%0Amargin%3A%2010px%3B%0A%7D%0Adiv%3Afirst-child%20%7B%20%0Abackground%3A%20-webkit-gradient(radial%2C%2025%25%2025%25%2C%200%2C%2050%25%2050%25%2C%20150%2C%20from(white)%2C%20to(black))%3B%0A%7D%0Adiv%3Anth-child(2)%20%7B%0Abackground%3A%20-webkit-gradient(radial%2C%2025%25%2025%25%2C%200%2C%2025%25%2025%25%2C%20225%2C%20from(white)%2C%20to(black))%3B%0A%7D">Illustration of moving geometric center vs. moving color focus</a></html> (view in webkit)
The ''<extent>'' is either a ''farthest/closest-side/corner'' keyword or an explicit ''<length>{1,2}''. Example: ''radial-gradient(5em circle at 10% 15%, white, black)''
Everything is optional except the colors. Examples: ''radial-gradient(5em, white, black)'', ''radial-gradient(circle, white, black)'', ''radial-gradient(at top left, white, black)'', ''radial-gradient(white, black)''.
<html>
<table rules="groups" class="data" cellpadding="5">
<caption>Syntax Comparison for Level 3</caption>
<thead>
<tr>
<th><a href="http://www.w3.org/TR/2011/WD-css3-images-20110908/#repeating-gradients">Current WD</a>
</th>
<th>Preview</th>
<th><a href="http://dev.w3.org/cvsweb/~checkout~/csswg/css3-images/Overview.html?rev=1.200;content-type=text%2Fhtml">Latest ED</a></th>
</tr>
</thead>
<tbody>
<tr>
<td><code>radial-gradient(white, black)</code></td>
<td rowspan="2"><img src="http://lists.w3.org/Archives/Public/www-archive/2011Nov/att-0019/radial1.png"/>
</td>
<td><code>radial-gradient(white, black)</code></td>
</tr>
<tr>
<td><code>radial-gradient(center, farthest-corner ellipse, white, black)</code></td>
<td><code>radial-gradient(farthest-corner ellipse at center, white, black)</code></td>
</tr>
</tbody>
<tbody>
<tr>
<td><code>radial-gradient(top left, white, black)</code></td>
<td rowspan="2"><img src="http://lists.w3.org/Archives/Public/www-archive/2011Nov/att-0019/radial2.png"/>
</td>
<td><code>radial-gradient(at top left, white, black)</code></td>
</tr>
<tr>
<td><code>radial-gradient(top left, farthest-corner ellipse, white, black)</code></td>
<td><code>radial-gradient(farthest-corner ellipse at top left, white, black)</code></td>
</tr>
</tbody>
<tbody>
<tr>
<td><code>radial-gradient(circle, white, black)</code></td>
<td rowspan="2"><img src="http://lists.w3.org/Archives/Public/www-archive/2011Nov/att-0019/radial3.png"/>
</td>
<td><code>radial-gradient(circle, white, black)</code></td>
</tr>
<tr>
<td><code>radial-gradient(circle, center, white, black)</code></td>
<td><code>radial-gradient(circle at center, white, black)</code></td>
</tr>
</tbody>
<tbody>
<tr>
<td><code>radial-gradient(center, 5em 5em, white, black)</code></td>
<td rowspan="2"><img src="http://lists.w3.org/Archives/Public/www-archive/2011Nov/att-0019/radial4.png"/>
</td>
<td><code>radial-gradient(5em, white, black)</code></td>
</tr>
<tr>
<td><code>radial-gradient(center, 5em 5em, white, black)</code></td>
<td><code>radial-gradient(circle 5em at center, white, black)</code></td>
</tr>
</tbody>
<tbody>
<tr>
<td><code>radial-gradient(75% 75%, closest-side circle, white, black)</code></td>
<td rowspan="2"><img src="http://lists.w3.org/Archives/Public/www-archive/2011Nov/att-0019/radial5.png"/>
</td>
<td><code>radial-gradient(closet-side circle at 75% 75%, white, black)</code></td>
</tr>
</tbody>
<tbody>
<tr>
<td><code>radial-gradient(25% 2em, 15px 30%, white, black)</code></td>
<td rowspan="2"><img src="http://lists.w3.org/Archives/Public/www-archive/2011Nov/att-0019/radial6.png"/>
</td>
<td><code>radial-gradient(15px 30% ellipse at 25% 2em, white, black)</code></td>
</tr>
</tbody>
</table>
</html>
==== Original Proposal ====
The original proposal was ''radial-gradient(<shape> to <extent> at <position>, <colors>)''. In this proposal all arguments after ''<shape>'' could be reordered. However, [[http://www.css3.info/radial-gradient-readability/|feedback on CSS3.info]] indicated that people find "to <length>" awkward, hence the Latest Proposal above.
For example, ''radial-gradient(5em circle at 25% 50px, white, black)''
Comparison to other proposal:
<html>
<table rules="groups" class="data" cellpadding="5">
<caption>Examples</caption>
<thead>
<tr>
<th>Alternate Proposal
</th>
<th>Preview</th>
<th><a href="http://dev.w3.org/cvsweb/~checkout~/csswg/css3-images/Overview.html?rev=1.200;content-type=text%2Fhtml">Current ED</a></th>
</tr>
</thead>
<tbody>
<tr>
<td><code>radial-gradient(white, black)</code></td>
<td rowspan="2"><img src="http://lists.w3.org/Archives/Public/www-archive/2011Nov/att-0019/radial1.png"/>
</td>
<td><code>radial-gradient(white, black)</code></td>
</tr>
<tr>
<td><code>radial-gradient(ellipse farthest-corner at center, white, black)</code></td>
<td><code>radial-gradient(ellipse to farthest-corner at center, white, black)</code></td>
</tr>
</tbody>
<tbody>
<tr>
<td><code>radial-gradient(at top left, white, black)</code></td>
<td rowspan="2"><img src="http://lists.w3.org/Archives/Public/www-archive/2011Nov/att-0019/radial2.png"/>
</td>
<td><code>radial-gradient(at top left, white, black)</code></td>
</tr>
<tr>
<td><code>radial-gradient(farthest-corner ellipse at top left, white, black)</code></td>
<td><code>radial-gradient(ellipse at top left to farthest-corner, white, black)</code></td>
</tr>
</tbody>
<tbody>
<tr>
<td><code>radial-gradient(5em circle, white, black)</code></td>
<td rowspan="2"><img src="http://lists.w3.org/Archives/Public/www-archive/2011Nov/att-0019/radial4.png"/>
</td>
<td><code>radial-gradient(to 5em, white, black)</code></td>
</tr>
<tr>
<td><code>radial-gradient(5em circle at center white, black)</code></td>
<td><code>radial-gradient(circle to 5em at center, white, black)</code></td>
</tr>
</tbody>
<tbody>
<tr>
<td><code>radial-gradient(closest-side circle at 75% 75%, white, black)</code></td>
<td rowspan="2"><img src="http://lists.w3.org/Archives/Public/www-archive/2011Nov/att-0019/radial5.png"/>
</td>
<td><code>radial-gradient(circle at 75% 75% to closest-side, white, black)</code></td>
</tr>
</tbody>
<tbody>
<tr>
<td><code>radial-gradient(15px 30% ellipse at 25% 2em, white, black)</code></td>
<td rowspan="2"><img src="http://lists.w3.org/Archives/Public/www-archive/2011Nov/att-0019/radial6.png"/>
</td>
<td><code>radial-gradient(ellipse to 15px 30% at 25% 2em, white, black)</code></td>
</tr>
</tbody>
</table>
</html>