-
Notifications
You must be signed in to change notification settings - Fork 708
/
Copy pathOverview.bs
1922 lines (1600 loc) · 68.8 KB
/
Overview.bs
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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<h1>CSS Basic User Interface Module Level 3 (CSS3 UI)</h1>
<pre class='metadata'>
ED: http://dev.w3.org/csswg/css-ui/
TR: http://www.w3.org/TR/css3-ui/
Previous Version: http://www.w3.org/TR/2012/WD-css3-ui-20120117/
Shortname: css-ui
Level: 3
Group: csswg
!Issue Tracking: http://wiki.csswg.org/spec/css3-ui
Status: ED
Editor: Tantek Çelik, Mozilla http://www.mozilla.org, tantek@cs.stanford.edu, http://tantek.com
Abstract: This specification describes user interface related selectors,
properties and values that are proposed for CSS level 3
to style HTML and XML (including XHTML).
It includes and extends user interface related features from the selectors,
properties and values of CSS level 2 revision 1 and Selectors specifications.
It uses various selectors,
properties and values to style basic user interface elements in a document.
Deadline: 2012-02-14
Link Defaults: css-color-3 (property) color
Link Defaults: selectors-4 (selector) :indeterminate
Link Defaults: css21 (property) border-width
Link Defaults: css21 (property) border-style
Ignored Terms: outline-top
Ignored Terms: outline-left
At Risk: ::value ::choices ::repeat-item ::repeat-index pseudo-elements
At Risk: 'box-sizing' property value: padding-box
At Risk: 'content' property value: icon
At Risk: 'icon' property
At Risk: 'ime-mode' property
At Risk: 'nav-index' property
At Risk: 'text-overflow' property value: <string>
At Risk: 'text-overflow' property 2-value syntax and definition
</pre>
<!--
At risk due to only one implementation, or obsolete dependency:
XForms is defunct on the web.
<li>XForms needs: :default :valid :invalid :in-range :out-of-range :required :optional :read-only :read-write ::value ::choices ::repeat-item ::repeat-index
<li>box-sizing: padding-box - only FF supports in prefixed version
<li>ime-mode: new - not sure about IE5+ vs FF3+ interop
<li>nav-index property
implemented for sure only by Opera, http://www.opera.com/docs/specs/presto22/#css
possibly obsolete: Tasman v1 internal implementation
possibly current: MSTV Tasman
required (depended on) by non-web DVB-HTML, ATSC standards
- unknown if any DVB-HTML or ATSC simulators
</li>
Not at risk:
<li>CSS2.1: :hover :active :focus
<li>Selectors: :enabled :disabled :checked
<li>:indeterminate implemented by FF3.6, IE9, Opera 10.6, Saf3
<li>box-sizing implemented by IE5/Mac, Opera
-moz-box-sizing implemented by Mozilla
<li>outline, outline-width, outline-color, outline-style all in CSS 2.1
<li>outline-offset property
implemented by Safari 1.2
<li>cursor property:
CSS2.1: auto | default | help | pointer | wait | crosshair | text |
e-resize | n-resize | ne-resize | nw-resize | s-resize | se-resize | sw-resize | w-resize
IE5/Mac implements: none | progress | cell
IE6/Windows implements: <uri> | progress | not-allowed | no-drop | vertical-text | all-scroll | col-resize | row-resize | move |
Mozilla implements: progress | cell(as -moz-cell) | alias(as -moz-alias) | copy(as -moz-copy) | context-menu(as -moz-context-menu) |
freedesktop.org copied all the cursors from the CSS3-UI LC Working Draft
by FredrikHoeglund - 14 Oct 2003
http://freedesktop.org/Standards/cursor-spec
<li>'cursor' property values: ew-resize | ns-resize | nesw-resize | nwse-resize
implemented by Firefox and Safari
<li>'resize' property
implemented by Firefox 4 and Safari
<li>nav-up, nav-down, nav-right, nav-left properties
implemented by Opera/Presto desktop with "shift+arrow", and Blink, as well as Samsung in webkit
-->
<hr title="Separator for header">
<h2 class="no-num no-toc" id="summary">Overview</h2>
This section is <em>informative</em>.
This document is one of the "modules" for the upcoming CSS3
specification. It not only describes the user interface related
properties and values that already exist in
<a href="http://www.w3.org/TR/REC-CSS1">CSS1</a> [[CSS1]]
and <a href="http://www.w3.org/TR/CSS21">CSS2.1</a> [[!CSS21]], but introduces
new properties and values for CSS3 as well.
The Working Group doesn't expect that all implementations of CSS3 will implement
all properties or values.
Instead, there will probably be a small number of variants of CSS3, so-called "profiles".
This document is the result of the merging of relevant parts of
the following Recommendations and Working Drafts, and the addition of some new features.
<ul>
<li>Cascading Style Sheets, level 2, revision 1 [[!CSS21]]
<li><a href="http://www.w3.org/TR/2000/WD-css3-userint-20000216">User Interface for CSS3 (16 February 2000)</a> [[CSSUI]]
</ul>
This specification contains:
<ul>
<li>Pseudo-classes and pseudo-elements to style
user interface states and element fragments respectively.
<li>Additions to the user interface features in
<a href="http://www.w3.org/TR/CSS21">CSS2.1</a>.
<li>Directional focus navigation properties.
<li>A mechanism to allow the styling of elements as icons for accessibility.
</ul>
<hr>
<h2 id="intro">Introduction</h2>
CSS3 is a set of modules, divided up and profiled in order to
simplify the specification,
and to allow implementors the flexibility of supporting
the particular modules appropriate for their implementations.
This module describes selectors and CSS properties which enable authors
to style user interface related states, element fragments, properties
and values.
<a href="http://www.w3.org/TR/REC-CSS1#anchor-pseudo-classes">Section 2.1 of CSS1</a> [[CSS1]]
and <a href="http://www.w3.org/TR/CSS2/ui.html">Chapter 18 of CSS2</a> [[CSS2]]
introduced several user interface related pseudo-classes, properties and values.
<a href="http://www.w3.org/TR/css3-selectors/#UIstates">Section 6.6.4 of Selectors</a> [[!SELECT]] also describes several additional user interface related pseudo-classes (and one pseudo-element).
This Working Draft extends them to provide the ability, through CSS,
to style elements based upon additional user interface states,
to style fragments of user interface elements, and to alter the
dynamic presentation of elements in ways previously only available through specific HTML4/XHTML1 elements and attributes.
<h3 id="purpose">Purpose</h3>
The purpose of this specification is to achieve the following objectives:
<ul>
<li>Extend the user interface features in CSS2.1.
<li>Provide additional CSS mechanisms to augment or replace other
dynamic presentation related features in HTML4/XHTML1.
<li>Introduce directional navigation properties to assist in the construction of
user interfaces which make use of a directional navigation model.
<li>Introduce properties and values to specify icon presentations for
elements to enhance accessibility.
</ul>
<h2 id="dependencies">Dependencies on other modules</h2>
This CSS3 module depends on the following other specifications.
<ul>
<li>[[!SELECT]]
<li>[[!CSS3COLOR]]
<li>[[!CSS21]]
<li>[[!CSS3VAL]]
<li>[[!CSS3-WRITING-MODES]]<!--for end, start, line-left, line-end-->
</ul>
<!--
It has non-normative (informative) references to the following
other specifications:
<ul>
</ul>
-->
The following work is related to the CSS Basic User Interface Module Level 3 (CSS3 Basic UI).
<ul>
<li>[[HTML401]]
<li>[[HTML5]]
<li>[[UAAG10]]
<li>[[XML10]]
<li>[[XHTML10]]
<li>[[XHTML11]]
<li>[[XFORMS11]]
</ul>
This specification does not define what is a form element.
<h2 id="selectors">User Interface Selectors</h2>
<h3 id="pseudo-classes">User interface states: pseudo-classes</h3>
The Selectors specification <a href="http://www.w3.org/TR/css3-selectors/#UIstates">defines several user interface selectors</a> ([[!SELECT]], sections 6.6.1 and 6.6.4)
which represent user interface states:
<ul><li id="pseudo-hover"><a href="http://www.w3.org/TR/css3-selectors/#useraction-pseudos">:hover</a>
<li id="pseudo-active"><a href="http://www.w3.org/TR/css3-selectors/#useraction-pseudos">:active</a>
<li id="pseudo-focus"><a href="http://www.w3.org/TR/css3-selectors/#useraction-pseudos">:focus</a>
<li id="pseudo-enabled"><a href="http://www.w3.org/TR/css3-selectors/#enableddisabled">:enabled</a>
<li id="pseudo-disabled"><a href="http://www.w3.org/TR/css3-selectors/#enableddisabled">:disabled</a>
<li id="pseudo-checked"><a href="http://www.w3.org/TR/css3-selectors/#checked">:checked</a>
<li id="pseudo-indeterminate"><a href="http://www.w3.org/TR/css3-selectors/#indeterminate">:indeterminate</a>
</ul>
These pseudo-classes as defined by [[!SELECT]] are
included in this specification by reference.
CSS 2.1 [[!CSS21]] specifies additional details
for some of the selectors mentioned, above and beyond Selectors.
<h4 id="active">:active details</h4>
In addition, on systems with more than one mouse button,
:active is clarified to apply only to the primary
or primary activation button (typically the "left" mouse button),
and any aliases thereof.
<h4 id="indeterminate">
The indeterminate-value pseudo-class '':indeterminate''</h4>
The '':indeterminate'' pseudo-class applies
to UI elements whose value is in an indeterminate state.
For example, radio and checkbox elements
can be toggled between checked and unchecked states,
but are sometimes in an indeterminate state,
neither checked nor unchecked.
Similarly a progress meter can be in an indeterminate state
when the percent completion is unknown.
Like the :checked pseudo-class,
'':indeterminate'' applies to all media.
Components of a radio-group initialized with no pre-selected choice,
for example, would be '':indeterminate''
even in a static display.
<h4 id="new-pseudo-classes" class="no-num no-toc">New user interface state pseudo-classes</h4>
In addition to the above-mentioned pseudo-classes,
this specification introduces several new pseudo-classes
to define additional user interface states.
<ul>
<li>:default
<li>:valid
<li>:invalid
<li>:in-range
<li>:out-of-range
<li>:required
<li>:optional
<li>:read-only
<li>:read-write
</ul>
Specifically, these new states (except for :default) are provided
as a way to style elements which are in the respective states as defined by XForms [[XFORMS11]].
<h4 id="pseudo-default">:default</h4>
The :default selector applies to the one or more UI elements
that are the default among a set of similar elements.
This selector typically applies to context menu items,
buttons, and select lists/menus.
One example is the default submit button among a set of buttons.
Another example is the default option from a popup menu.
Multiple elements in a select-many group could have multiple :default elements,
like a selection of pizza toppings for example.
<h4 id="pseudo-validity"><span id="pseudo-valid">:valid</span>
and <span id="pseudo-invalid">:invalid</span></h4>
An element is :valid or :invalid when it is,
respectively, valid or invalid with respect to data validity semantics
defined by a different specification (e.g. [[XFORMS11]]).
An element which lacks data validity semantics is neither :valid nor :invalid.
This is different from an element which otherwise has no constraints.
Such an element would always be :valid.
<h4 id="pseudo-range"><span id="pseudo-in-range">:in-range</span> and <span id="pseudo-out-of-range">:out-of-range</span></h4>
The :in-range and :out-of-range pseudo-classes apply only to elements that have range limitations.
An element is :in-range or :out-of-range
when the value that the element is bound to is in range or out of range
of the presentation (e.g. visual or spoken representation) of the element respectively.
An element that lacks data range limits or is not a form control is neither :in-range nor :out-of-range.
E.g. a slider element with a value of 11
presented as a slider control that only represents the values from 1-10 is :out-of-range.
Another example is a menu element with a value of "E"
that happens to be presented as a popup menu that only has choices "A", "B" and "C".
<h4 id="pseudo-required-value"><span id="pseudo-required">:required</span>
and <span id="pseudo-optional">:optional</span></h4>
A form element is :required or :optional if a value for it
is, respectively, required or optional before the form it belongs to is submitted.
Elements that are not form elements are neither required nor optional.
<h4 id="pseudo-ro-rw"><span id="pseudo-read-only">:read-only</span>
and <span id="pseudo-read-write">:read-write</span></h4>
An element whose contents are not user-alterable is :read-only.
However, elements whose contents are user-alterable (such as text input fields)
are considered to be in a :read-write state.
In typical documents, most elements are :read-only.
However it may be possible (e.g. in the context of an editor) for any element to become :read-write.
<h3 id="pseudo-elements">User interface element fragments: pseudo-elements</h3>
In addition to the above-mentioned pseudo-element,
this specification introduces four new pseudo-elements
to provide access to additional user interface element fragments.
<ul>
<li>::value
<li>::choices
<li>::repeat-item
<li>::repeat-index
</ul>
Specifically, these new pseudo-elements are provided
as a way to style user interface fragments
as defined by XForms [[XFORMS11]].
Note: The ::value, ::choices, ::repeat-item, and ::repeat-index
pseudo-elements are all at risk.
<h4 id="pseudo-value">::value</h4>
A form element may contain both a label for its data value,
and the data value itself.
For such elements, the ::value pseudo-element
selects the representation of just the data value itself,
in order to style its appearance.
<div class="example"><p style="display:none">Example(s):
<h4 id="value-example" class="no-num no-toc">fictional markup and illustration</h4>
Here is an example which illustrates the ::value of a text input field
with fictional markup which is then styled with CSS.
sample XForms fragment with fictional markup:
<pre><code class="lang-markup">
<input>
<label>Zip code<label>
<em><input::value/></em>
</input>
</code></pre>
sample CSS:
<pre><code class="lang-css">
input { border:dashed }
label { border:dotted }
input::value { border:solid }
</code></pre>
an HTML+CSS approximation of this example
<p>
<span style="border:dashed;display:inline-block;padding:10px">
<label
style="border:dotted;display:inline-block;padding:2px;margin:0;font-size:1em"
>Zip code</label>
<input type="text"
style="border:solid;display:inline-block;padding:2px;margin:0;font-size:1em"
value="94117">
</span>
Spacing (in the form of padding) has been added to the above approximation
to separate the borders and make the individual (pseudo-)elements easier to distinguish.
</div>
The ''::value'' pseudo-element is similar to an inline-level element,
but with certain restrictions.
The following properties apply to ''::value''
pseudo-element: font properties, color property, background properties,
'word-spacing', 'letter-spacing', 'text-decoration', 'vertical-align',
'text-transform', 'line-height'. UAs may apply other properties as well.
<h4 id="pseudo-choices">::choices</h4>
Similarly, a form element which represents a list of options
may contain both a label for the list,
and the list of choices itself.
For such elements,
the ''::choices'' pseudo-element selects
the representation of just the list of choices themselves,
in order to style their appearance.
A list of radio buttons can also be selected with the ''::choices'' pseudo-element,
and the currently chosen radio button can be selected with the ''::value'' pseudo-element.
<h4 id="pseudo-repeat-item">::repeat-item</h4>
The ''::repeat-item'' pseudo-element represents a single item from a repeating sequence.
It is generated as a parent to all the elements in a single repeating item.
Each ''::repeat-item'' is associated with a particular instance data node,
and is affected by the model item properties (e.g. '<code>relevant</code>') found there,
as the related style properties will cascade to the child elements.
<h4 id="pseudo-repeat-index">::repeat-index</h4>
The ::repeat-index pseudo-element represents the current item of a repeating sequence.
It takes the place of the ::repeat-item as a parent of all the elements in the index repeating item.
Note: Any style declarations that an author wants to apply to all repeat items,
including the index,
must be done so by using both ::repeat-item and ::repeat-index selectors.
Styles that are only applied to ::repeat-item will not automatically be applied to the respective ::repeat-index.
<div class="example"><p style="display:none">Example(s):
<h4 id="repeat-item-index-example" class="no-num no-toc">::repeat-item and ::repeat-index fictional markup</h4>
Here is an example that illustrates both ::repeat-item and ::repeat-index,
since they are often both available and used at the same time.
Assume appropriate namespace declarations were made in a header somewhere
preceding the code in the example.
The following markup snippet uses XHTML and XForms:
<pre><code class="lang-markup">
<html:table xforms:repeat-nodeset="...">
<html:tr>
<html:td><xforms:input ref="..."/><xforms:input ref="..."/></html:td>
</html:tr>
</html:table>
</code></pre>
The following style rules are used to style all the repeated items and the current repeated item.
<pre><code class="lang-css">
html|tr::repeat-item { outline: medium solid; color:gray }
html|tr::repeat-index { outline: medium dashed; color:black }
</code></pre>
The following fictional markup shows
the state of the above markup
when through user interaction the XForm contains three of the repeated items,
where the third item is current.
<pre><code class="lang-markup">
<html:table xforms:repeat-nodeset="...">
<em><html:tr::repeat-item></em>
<html:tr>
<html:td><xforms:input ref="..."/><xforms:input ref="..."/></html:td>
</html:tr>
<em></html:tr::repeat-item></em>
<em><html:tr::repeat-item></em>
<html:tr>
<html:td><xforms:input ref="..."/><xforms:input ref="..."/></html:td>
</html:tr>
<em></html:tr::repeat-item></em>
<em><html:tr::repeat-index></em>
<html:tr>
<html:td><xforms:input ref="..."/><xforms:input ref="..."/></html:td>
</html:tr>
<em></html:tr::repeat-index></em>
</html:table>
</code></pre>
</div>
Note: The ::repeat-index pseudo-element takes the place of the ::repeat-item
rather than being nested inside as a separate element.
Thus just like :link or :visited are mutually exclusive for selecting hyperlinks,
only one will exist and apply to a particular repeated item at any point.
<h2 id="icons">Element icons</h2>
<h3 id="content-addition">'content' property addition</h3>
<table class="propdef"><tbody>
<tr><th>Name:</th><td><dfn>content</dfn></td></tr>
<tr><th>New Value(s):</th><td title="">icon</td></tr>
<tr><th>Initial:</th><td>same as CSS 2.1</td></tr>
<tr><th>Applies to:</th><td>same as CSS 2.1</td></tr>
<tr><th>Inherited:</th><td>same as CSS 2.1</td></tr>
<tr><th>Percentages:</th><td>same as CSS 2.1</td></tr>
<tr><th>Media:</th><td>same as CSS 2.1</td></tr>
<tr><th>Computed value:</th><td>the keyword ''icon'' if specified as such, otherwise same as CSS 2.1</td></tr>
<tr><th>Animatable:</th><td>no</td></tr>
</tbody></table>
<dl>
<dt>icon</dt>
<dd>The (pseudo-)element is replaced in its entirety by the resource referenced by its 'icon' property, and treated as a replaced element.
</dd>
</dl>
Note: It is expected that the next draft of the CSS3 Generated Content module [[CSS3GENCON]]
will include and superset this functionality.
Note: The ''icon'' value is at risk.
<h3 id="icon">'icon' property</h3>
<table class="propdef"><tbody>
<tr><th>Name:</th><td><dfn>icon</dfn></td></tr>
<tr><th>Value:</th><td>auto | <uri> [, <uri>]* | inherit</td></tr>
<tr><th>Initial:</th><td>auto</td></tr>
<tr><th>Applies to:</th><td>all elements</td></tr>
<tr><th>Inherited:</th><td>no</td></tr>
<tr><th>Percentages:</th><td>N/A</td></tr>
<tr><th>Media:</th><td>all</td></tr>
<tr><th>Computed value:</th><td>as specified, except with any relative URLs converted to absolute</td></tr>
<tr><th>Animatable:</th><td>no</td></tr>
</tbody></table>
<dl>
<dt>auto</dt>
<dd>Use a default generic icon provided by the user agent.</dd>
<dt><uri></dt>
<dd>URIs (see [[!URI]], [[!RFC1738]] and [[!RFC1808]]) provide a way of identifying resources.
The <uri> value(s) in this property refer to one or more icons in a comma delimited list.
The user agent loads the referenced icons one by one until it finds one that it is able to render.
This permits the usage of multiple different icon formats for various platforms,
and various media for that matter.</dd>
</dl>
The 'icon' property provides the author
the ability to style any arbitrary element with an iconic equivalent.
An element's icon is not used/rendered
unless the 'content' property is set
to the value ''icon''(see above).
Documents whose elements have icons assigned to them
can be more easily viewed by users who find too much text distracting.
<div class="example"><p style="display:none">Example(s):
<h4 id="icon-example" class="no-num no-toc">Representing elements with icons</h4>
This example uses the above icon features to display icons in place of images and objects.
<pre><code class="lang-css">
img,object { content:icon }
/* note that the CSS3 Generated Content module [[CSS3GENCON]]
expands the 'content'property to apply to all elements. */
img { icon:url(imgicon.png); }
/* provide a custom icon for images */
object { icon:url(objicon.png); }
/* provide a different custom icon for objects */
</code></pre>
</div>
Note: The 'icon' property is at risk.
<h2 id="box-model">Box Model addition</h2>
<h3 id="box-sizing">'box-sizing' property</h3>
<table class="propdef"><tbody>
<tr><th>Name:</th><td><dfn>box-sizing</dfn></td></tr>
<tr><th>Value:</th><td>
content-box |
padding-box |
border-box |
inherit</td></tr>
<tr><th>Initial:</th><td>content-box</td></tr>
<tr><th>Applies to:</th><td>all elements that accept width or height</td></tr>
<tr><th>Inherited:</th><td>no</td></tr>
<tr><th>Percentages:</th><td>N/A</td></tr>
<tr><th>Media:</th><td>visual</td></tr>
<tr><th>Computed value:</th><td>specified value</td></tr>
<tr><th>Animatable:</th><td>no</td></tr>
</tbody></table>
<dl>
<dt>content-box</dt>
<dd>This is the behavior of width and height as specified by CSS2.1.
The specified width and height (and respective min/max properties)
apply to the width and height respectively of the content box of the element.
The padding and border of the element are laid out
and drawn outside the specified width and height.</dd>
<dt>padding-box</dt>
<dd>
The specified width and height (and respective min/max properties)
on this element determine the padding box of the element.
That is, any padding specified on the element is laid out
and drawn inside this specified width and height.
The content width and height are calculated by
subtracting the padding widths of the respective sides
from the specified 'width' and
'height' properties.
As the content width and height
<a href="http://www.w3.org/TR/CSS21/visudet.html#the-width-property">
cannot be negative</a> ([[!CSS21]], section 10.2),
this computation is floored at 0.
</dd>
<dt>border-box</dt>
<dd>The specified width and height (and respective min/max properties) on this element
determine the border box of the element.
That is, any padding or border specified on the element
is laid out and drawn inside this specified width and height.
The content width and height are calculated
by subtracting the border and padding widths of the respective sides
from the specified 'width'
and 'height' properties.
As the content width and height
<a href="http://www.w3.org/TR/CSS21/visudet.html#the-width-property">cannot be negative</a> ([[!CSS21]], section 10.2),
this computation is floored at 0.
Note: This is the behavior of width and height as commonly implemented
by legacy HTML user agents for replaced elements and input elements.
</dd>
</dl>
<div class="example"><p style="display:none">Example(s):
<h4 id="box-sizing-example" class="no-num no-toc">Using box-sizing to evenly share space</h4>
This example uses box-sizing to evenly horizontally split
two divs with fixed size borders inside a div container,
which would otherwise require additional markup.
sample CSS:
<pre><code class="lang-css">
div.container {
width:38em;
border:1em solid black;
}
div.split {
box-sizing:border-box;
width:50%;
border:1em silver ridge;
float:left;
}
</code></pre>
sample HTML fragment:
<pre><code class="lang-markup">
<div class="container">
<div class="split">This div occupies the left half.</div>
<div class="split">This div occupies the right half.</div>
</div>
</code></pre>
demonstration of sample CSS and HTML:
<div style="width:38em; border:1em solid black"><div style="box-sizing:border-box; width:50%; border:1em silver ridge; float:left">This div should occupy the left half.</div><div style="box-sizing:border-box; width:50%; border:1em silver ridge; float:left">This div should occupy the right half.</div>The two divs above should appear side by side, each (including borders) 50% of the content width of their container. If instead they are stacked one on top of the other then your browser does not support 'box-sizing'.
</div>
</div>
Note: The ''padding-box'' value is at risk.
<h2 id="outline-props">Outline properties</h2>
At times, style sheet authors may want to create outlines around
visual objects such as buttons, active form fields, image maps, etc.,
to make them stand out. Outlines differ from borders in the following
ways:
<ol>
<li>Outlines do not take up space.
<li>Outlines may be non-rectangular.
</ol>
The outline properties control the style of these dynamic outlines.
<h3 id="outline">'outline' property</h3>
<table class="propdef"><tbody>
<tr><th>Name:</th><td><dfn>outline</dfn></td></tr>
<tr><th>Value:</th><td>
[ <'outline-color'> || <'outline-style'> ||
<'outline-width'> ] |
inherit
</td></tr>
<tr><th>Initial:</th><td>see individual properties</td></tr>
<tr><th>Applies to:</th><td>all elements</td></tr>
<tr><th>Inherited:</th><td>no</td></tr>
<tr><th>Percentages:</th><td>N/A</td></tr>
<tr><th>Media:</th><td>visual</td></tr>
<tr><th>Computed value:</th><td>see individual properties</td></tr>
<tr><th>Animatable:</th><td>see individual properties</td></tr>
</tbody></table>
<h3 id="outline-width">'outline-width' property</h3>
<table class="propdef"><tbody>
<tr><th>Name:</th><td><dfn>outline-width</dfn></td></tr>
<tr><th>Value:</th><td><<'border-width'>> | inherit</td></tr>
<tr><th>Initial:</th><td>medium</td></tr>
<tr><th>Applies to:</th><td>all elements</td></tr>
<tr><th>Inherited:</th><td>no</td></tr>
<tr><th>Percentages:</th><td>N/A</td></tr>
<tr><th>Media:</th><td>visual</td></tr>
<tr><th>Computed value:</th><td>absolute length; ''0'' if the outline style is ''none''.</td></tr>
<tr><th>Animatable:</th><td>as <a href="http://dev.w3.org/csswg/css3-transitions/#animtype-length">length</a></td></tr>
</tbody></table>
<h3 id="outline-style">'outline-style' property</h3>
<table class="propdef"><tbody>
<tr><th>Name:</th><td><dfn>outline-style</dfn></td></tr>
<tr><th>Value:</th><td>auto | <<'border-style'>> | inherit</td></tr>
<tr><th>Initial:</th><td>none</td></tr>
<tr><th>Applies to:</th><td>all elements</td></tr>
<tr><th>Inherited:</th><td>no</td></tr>
<tr><th>Percentages:</th><td>N/A</td></tr>
<tr><th>Media:</th><td>visual</td></tr>
<tr><th>Computed value:</th><td>specified value</td></tr>
<tr><th>Animatable:</th><td>no</td></tr>
</tbody></table>
<h3 id="outline-color">'outline-color' property</h3>
<table class="propdef"><tbody>
<tr><th>Name:</th><td><dfn>outline-color</dfn></td></tr>
<tr><th>Value:</th><td><<color>> | invert | inherit</td></tr>
<tr><th>Initial:</th><td>invert</td></tr>
<tr><th>Applies to:</th><td>all elements</td></tr>
<tr><th>Inherited:</th><td>no</td></tr>
<tr><th>Percentages:</th><td>N/A</td></tr>
<tr><th>Media:</th><td>visual</td></tr>
<tr><th>Computed value:</th><td>The computed value for ''invert'' is ''invert''. For <color> values, the computed value is as defined for the [[!CSS3COLOR]] 'color' property.</td></tr>
<tr><th>Animatable:</th><td>as <a href="http://dev.w3.org/csswg/css3-transitions/#animtype-color">color</a></td></tr>
</tbody></table>
The outline created with the outline properties is drawn "over" a box,
i.e., the outline is always on top,
and doesn't influence the position or size of the box,
or of any other boxes.
Therefore, displaying or suppressing outlines does not cause reflow.
Outlines may be non-rectangular.
For example, if the element is broken across several lines,
the outline should be an outline or minimum set of outlines
that encloses all the element's boxes.
Each part of the outline should be fully connected
rather than open on some sides
(as borders on inline elements are when lines are broken).
The parts of the outline are not required to be rectangular.
The position of the outline may be affected by descendant boxes.
User agents should use an algorithm for determining
the outline that encloses a region appropriate
for conveying the concept of focus to the user.
The 'outline-width' property accepts
the same values as
'border-width'
([[!CSS21]], section 8.5.1).
The 'outline-style' property accepts
the same values as
'border-style'
([[!CSS21]], section 8.5.3), except that
''hidden'' is not a legal outline style.
In addition, in CSS3,
'outline-style'
accepts the value ''auto''.
The ''auto'' value permits the user agent
to render a custom outline style,
typically a style which is either a user interface default for the platform,
or perhaps a style that is richer
than can be described in detail in CSS,
e.g. a rounded edge outline with semi-translucent outer pixels
that appears to glow.
As such, this specification does not define how the
'outline-color'
is incorporated or used (if at all) when rendering
''auto'' style outlines.
User agents may treat ''auto'' as
''solid''.
The 'outline-color' property
accepts all colors, as well as the keyword <dfn>invert</dfn>.
''Invert'' is expected to perform a color inversion on the pixels on the screen.
This is a common trick to ensure the focus border is visible,
regardless of color background.
Conformant UAs may ignore the ''invert'' value
on platforms that do not support color inversion of the pixels on the screen.
If the UA does not support the ''invert'' value
then the initial value of the 'outline-color' property
is the ''currentColor'' [[!CSS3COLOR]] keyword.
The 'outline' property is a shorthand property,
and sets all three of 'outline-style',
'outline-width',
and 'outline-color'.
Note: The outline is the same on all sides.
In contrast to borders,
there are no 'outline-top' or 'outline-left' etc. properties.
This specification does not define how multiple overlapping outlines are drawn,
or how outlines are drawn for boxes that are partially obscured behind other elements.
<div class="example"><p style="display:none">Example(s):
Here's an example of drawing a thick outline around a BUTTON element:
<pre><code class="lang-css">
button { outline: thick solid }
</code></pre>
</div>
Graphical user interfaces may use outlines around elements
to tell the user which element on the page has the focus.
These outlines are in addition to any borders,
and switching outlines on and off should not cause the document to reflow.
The focus is the subject of user interaction in a document
(e.g., for entering text, selecting a button, etc.).
<div class="example"><p style="display:none">Example(s):
For example, to draw a thick black line around an element when it has the focus,
and a thick red line when it is active,
the following rules can be used:
<pre><code class="lang-css">
:focus { outline: thick solid black }
:active { outline: thick solid red }
</code></pre>
</div>
Note: Since the outline does not affect formatting
(i.e., no space is left for it in the box model),
it may well overlap other elements on the page.
<h3 id="outline-offset">'outline-offset' property</h3>
By default, the outline is drawn starting just outside the border edge.
However, it is possible to offset the outline and draw it beyond the border edge.
<table class="propdef"><tbody>
<tr><th>Name:</th><td><dfn>outline-offset</dfn></td></tr>
<tr><th>Value:</th><td><length> | inherit</td></tr>
<tr><th>Initial:</th><td>0</td></tr>
<tr><th>Applies to:</th><td>all elements</td></tr>
<tr><th>Inherited:</th><td>no</td></tr>
<tr><th>Percentages:</th><td>N/A</td></tr>
<tr><th>Media:</th><td>visual</td></tr>
<tr><th>Computed value:</th><td><length> value in absolute units (px or physical).</td></tr>
<tr><th>Animatable:</th><td>as <a href="http://dev.w3.org/csswg/css3-transitions/#animtype-length">length</a></td></tr>
</tbody></table>
If the computed value of 'outline-offset'
is anything other than 0,
then the outline is outset from the border edge by that amount.
<div class="example"><p style="display:none">Example(s):
For example,
to leave 2 pixels of space between a focus outline
and the element that has the focus or is active,
the following rule can be used:
<pre><code class="lang-css">
:focus,:active { outline-offset: 2px }
</code></pre>
</div>
<h2 id="resizing-and-overflow">Resizing & Overflow</h2>
CSS2.1 provides a mechanism for controlling the appearance of a scrolling mechanism
(e.g. scrollbars)
on block container elements.
This specification adds to that a mechanism for controlling
user resizability of elements as well as the ability to specify text overflow behavior.
<h3 id="resize">'resize' property</h3>
The 'resize' property allows the author
to specify whether or not an element is resizable by the user,
and if so, along which axis/axes.
<table class="propdef"><tbody>
<tr><th>Name:</th><td><dfn>resize</dfn></td></tr>
<tr><th>Value: </th><td>none | both | horizontal | vertical | inherit</td></tr>
<tr><th>Initial:</th><td>none</td></tr>
<tr><th>Applies to:</th><td>elements with 'overflow' other than visible</td></tr>
<tr><th>Inherited:</th><td>no</td></tr>
<tr><th>Percentages:</th><td>N/A</td></tr>
<tr><th>Media:</th><td>visual</td></tr>
<tr><th>Computed value:</th><td>specified value.</td></tr>
<tr><th>Animatable:</th><td>no</td></tr>
</tbody></table>
<dl>
<dt>none</dt>
<dd>The UA does not present a resizing mechanism on the element,
and the user is given no direct manipulation mechanism to resize the element.</dd>
<dt>both</dt>
<dd>The UA presents a bidirectional resizing mechanism
to allow the user to adjust both the height and the width of the element.</dd>
<dt>horizontal</dt>
<dd>The UA presents a unidirectional horizontal resizing mechanism
to allow the user to adjust only the width of the element.</dd>
<dt>vertical</dt>
<dd>The UA presents a unidirectional vertical resizing mechanism
to allow the user to adjust only the height of the element.</dd>
</dl>
Currently it is possible to control the appearance of the scrolling mechanism (if any)
on an element using the 'overflow' property
(e.g. '<code class="lang-css">overflow: scroll</code>' vs. '<code class="lang-css">overflow: hidden</code>' etc.).
The purpose of the 'resize' property
is to also allow control over the appearance and function of the resizing mechanism
(e.g. a resize box or widget) on the element.
Note: The resizing mechanism is NOT the same as the scrolling mechanism.
The scrolling mechanism allows the user
to determine which portion of the contents of an element is shown.
The resizing mechanism allows the user
to determine the size of the element.
The 'resize' property applies to elements
whose computed 'overflow' value
is something other than ''visible''.
When an element is resized by the user,
the user agent keeps track of a resize factor
(which is initially 1.0) for the width and height,
which it then applies to the computed width and height
as part of determining the used width and height.
The element's contents (and surroundings) are reformatted as necessary.
The resize factor introduces a step in width/height calculations and formatting
as described in <a href="http://www.w3.org/TR/CSS21/visudet.html">chapter 10 of CSS2.1</a>.
Specifically the following step is inserted between steps 1 and 2
of the algorithm in <a href="http://www.w3.org/TR/CSS21/visudet.html#min-max-widths">section 10.4</a>
and <a href="http://www.w3.org/TR/CSS21/visudet.html#min-max-heights">10.7</a> in CSS2.1 [[!CSS21]],
where [dimension] is 'width' for 10.4 and 'height' for 10.7.
<blockquote><p style="text-indent:-2em">
1b. If the resize [dimension] factor is not 1.0,
then the tentative used [dimension] is multiplied by that factor,
and the rules above are applied again,
but this time using the result of that multiplication as the computed value for '[dimension]'.
</blockquote>
With regard to interactivity and the Document Object Model (DOM),
the resize factor on an element lasts the lifetime of the element,
however, if the 'resize' property itself is altered
(e.g. via pseudo-class change or via DOM manipulation),
then the resize factor is reset to 1.0.
The precise direction of resizing
(i.e. altering the top left of the element or altering the bottom right)
may depend on a number of factors
including whether the element is absolutely positioned,
whether it is positioned using the 'right'
and 'bottom' properties,
whether the language of the element is right-to-left etc.
The precise direction of resizing is left to the UA to properly determine for the platform.
The user agent may restrict the resizing range to something suitable,
such as between the original formatted size of the element,
and large enough to encompass all the element's contents.
<div class="example"><p style="display:none">Example(s):
For example,
to make iframes scrollable <em>and</em> resizable,
the following rule can be used:
<pre><code class="lang-css">
iframe,object[type^="text/"],
object[type$="+xml"],object[type="application/xml"]
{
overflow:auto;
resize:both;
}
</code></pre>
</div>
<!--
too bad we don't have @viewport yet. otherwise this would be cool:
<pre><code class="lang-css">
@viewport {
width: 100px;
height: 100px;
overflow: hidden;
resize: none
} /* display content in a non-resizable 100px by 100px window */
</code></pre>
-->
<h3 id="text-overflow">
Overflow Ellipsis: the 'text-overflow' property</h3>
<table class="propdef"><tbody>
<tr><th>Name:</th>
<td><dfn>text-overflow</dfn></td></tr>
<tr><th>Value:</th>
<td> (
clip |
ellipsis |
<<string>>
){1,2} |
inherit
</td></tr>
<tr><th>Initial:</th>
<td>clip</td></tr>
<tr><th>Applies to:</th>
<td>block containers</td></tr>
<tr><th>Inherited:</th>
<td>no</td></tr>
<tr><th>Percentages:</th>
<td>N/A</td></tr>
<tr><th>Media:</th>
<td>visual</td></tr>
<tr><th>Computed value:</th>
<td>as specified</td></tr>
<tr><th>Animatable:</th>