-
Notifications
You must be signed in to change notification settings - Fork 664
/
Overview.bs
3081 lines (2549 loc) · 113 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
<!--
Coding style convention in this file:
* Use semantic line breaks (http://rhodesmill.org/brandon/2012/one-sentence-per-line/)
* Tabs for indentation, spaces for alignment (http://lea.verou.me/2012/01/why-tabs-are-clearly-superior/)
* Use markdown paragraphs (empty lines between paragraphs) over <p> when practical
* two empty lines above <h*>, one below <h*>, one between <hn> and <hn+1>
* empty line between <ol>, <ul>, <table>, <div> and adjacent text
* Don't close <p>, <li>, <dd>, <dt>, <tr>, <th>, or <td>
* Indent the content and break line after the opening <li>, <dd>, <dt>, <td>, or <th> if it's more than 2 lines long
or for lists where at least some elements are more than 2 lines long
* Empty line between adjacent <li>, <th>, <td>, <tr>, and between <dd> and the next <dt>;
Can be skipped if all items are very short
* Indent the content of <ol>, <ul>, <dl>, <table>, <tr>
* Indent the content of <div class=note> and <div class=example>
-->
<pre class='metadata'>
Title: CSS Basic User Interface Module Level 4
ED: https://drafts.csswg.org/css-ui-4/
Status Text: This specification will include and extend <cite>CSS Basic User Interface Module Level 3.</cite> [[CSS-UI-3]]
TR: https://www.w3.org/TR/css-ui-4/
Previous Version: https://www.w3.org/TR/2021/WD-css-ui-4-20210316/
Previous Version: https://www.w3.org/TR/2020/WD-css-ui-4-20200124/
Previous Version: https://www.w3.org/TR/2020/WD-css-ui-4-20200102/
Previous Version: https://www.w3.org/TR/2017/WD-css-ui-4-20171222/
Previous Version: https://www.w3.org/TR/2015/WD-css-ui-4-20150922/
Shortname: css-ui
Level: 4
Status: ED
Group: csswg
Work Status: Revising
Editor: Florian Rivoal, On behalf of Bloomberg, https://florian.rivoal.net/, w3cid 43241
Editor: Tab Atkins-Bittner, Google, http://xanthir.com/contact/, w3cid 42199
Abstract: This specification describes user interface related
properties and values to style HTML and XML (including XHTML).
It includes and extends user interface related features
from the properties and values of previous CSS levels.
It uses various properties and values
to style basic user interface elements in a document.
At risk: Applicability of 'user-select' to ''::before'' and ''::after''
Can I Use URL: https://drafts.csswg.org/css-ui-3/
Can I Use URL: http://drafts.csswg.org/css-ui-3/
Can I Use URL: https://drafts.csswg.org/css-ui/
Can I Use URL: http://drafts.csswg.org/css-ui/
Can I Use URL: https://www.w3.org/TR/css-ui-3/
Can I Use URL: http://www.w3.org/TR/css-ui-3/
Can I Use URL: https://www.w3.org/TR/css3-ui/
Can I Use URL: http://www.w3.org/TR/css3-ui/
Can I Use URL: https://drafts.csswg.org/css-ui-4/
Can I Use URL: http://drafts.csswg.org/css-ui-4/
Can I Use URL: https://www.w3.org/TR/css-ui-4/
Can I Use URL: http://www.w3.org/TR/css-ui-4/
Ignore Can I Use URL Failure: https://drafts.csswg.org/css-ui-3/
Ignore Can I Use URL Failure: http://drafts.csswg.org/css-ui-3/
Ignore Can I Use URL Failure: https://drafts.csswg.org/css-ui/
Ignore Can I Use URL Failure: http://drafts.csswg.org/css-ui/
Ignore Can I Use URL Failure: https://www.w3.org/TR/css-ui-3/
Ignore Can I Use URL Failure: http://www.w3.org/TR/css-ui-3/
Ignore Can I Use URL Failure: https://www.w3.org/TR/css3-ui/
Ignore Can I Use URL Failure: http://www.w3.org/TR/css3-ui/
Ignore Can I Use URL Failure: https://drafts.csswg.org/css-ui-4/
Ignore Can I Use URL Failure: http://drafts.csswg.org/css-ui-4/
Ignore Can I Use URL Failure: https://www.w3.org/TR/css-ui-4/
Ignore Can I Use URL Failure: http://www.w3.org/TR/css-ui-4/
</pre>
<pre class=link-defaults>
spec:css-writing-modes-4; type:dfn; text:start
spec:css-writing-modes-4; type:dfn; text:end
spec:css2; type:property; text:min-width
spec:css2; type:property; text:max-width
spec:css2; type:property; text:min-height
spec:css2; type:property; text:max-height
spec:css2; type:property; text:bottom
spec:css2; type:property; text:top
spec:css2; type:property; text:right
spec:css2; type:property; text:visibility
spec:css2; type:property; text:z-index
spec:css-overflow-3; type:dfn; text:ink overflow area
spec:css-pseudo-4; type:selector; text:::before
spec:css-pseudo-4; type:selector; text:::after
spec:css-pseudo-4; type:selector; text:::first-line
spec:css-pseudo-4; type:selector; text:::first-letter
spec:selectors-4; type:selector; text::checked
spec:css-display-3; type:property; text:display
spec:css-color-4; type:value; text:currentcolor
spec:css-overflow-3; type:property; text:overflow
spec:css-sizing-3; type:property; text:box-sizing
spec:css-backgrounds-3; type:property; text:background-image
spec:css-backgrounds-3; type:property; text:border-width
spec:css-overflow-4; type:property; text:text-overflow
spec:selectors-4; type:selector; text::enabled
spec:selectors-4; type:selector; text::disabled
spec:css-color-4; type:property; text:color
spec:selectors-4; type:selector; text::focus
spec:selectors-4; type:selector; text::focus-visible
spec:css-backgrounds-3; type:property; text:border-radius
spec:css-backgrounds-3; type:property; text:border-color
spec:css-backgrounds-3; type:property; text:border-top-color
spec:css-backgrounds-3; type:property; text:border-right-color
spec:css-backgrounds-3; type:property; text:border-bottom-color
spec:css-backgrounds-3; type:property; text:border-left-color
</pre>
<pre class=anchors>
urlPrefix: https://html.spec.whatwg.org/multipage/; spec:HTML
text:password; type:attr-value; for:input/type; url: input.html#attr-input-type-password-keyword
</pre>
<style>
.awesome-table td {padding:5px}
.awesome-table {color:#000;background:#fff;margin: auto;}
.fake-textarea {
background: white;
border: inset;
color: black;
display: inline-block;
font-family: monospace;
padding: 0 2px;
}
.fake-textarea.auto {
height: 2lh;
overflow: auto;
resize: both;
width: 10em;
}
.fake-textarea.normal {
width: 10em;
}
.fake-input-type-password {
display: inline-block;
border: 1px solid black;
background: white;
text: black;
width: 20ch;
padding: 0 2px;
}
</style>
<h2 id="intro">
Introduction</h2>
This module describes CSS properties which enable authors
to style user interface related properties and values.
<a href="https://www.w3.org/TR/REC-CSS1#anchor-pseudo-classes">Section 2.1 of CSS1</a> [[CSS1]]
and <a href="https://www.w3.org/TR/CSS2/ui.html">Chapter 18 of CSS2</a> [[CSS21]]
introduced several user interface related properties and values.
<a href="https://www.w3.org/TR/2000/WD-css3-userint-20000216">User Interface for CSS3 (16 February 2000)</a> introduced several new user interface related features.
[[CSS-UI-3]] was later introduced to incorporate, extend, and supersede these.
This specification continues this work, and in turn replaces [[CSS-UI-3]].
<h3 id="purpose">
Purpose</h3>
The purpose of this specification is to achieve the following objectives:
<ul>
<li>
Extend the user interface features in [[CSS21]] and [[CSS-UI-3]]
<li>
Provide additional CSS mechanisms to augment or replace other
dynamic presentation related features in HTML.
<li>
Introduce directional navigation properties to assist in the construction of
user interfaces which make use of a directional navigation model.
</ul>
<h2 id="interaction">Module Interactions</h2>
This document defines new features not present in earlier specifications.
In addition, it replaces and supersedes [[!CSS-UI-3]],
which itself replaced and superseded the following:
<ul>
<li>
<a href="https://www.w3.org/TR/CSS21/ui.html#cursor-props">Section 18.1</a>,
<a href="https://www.w3.org/TR/CSS21/ui.html#dynamic-outlines">section 18.4</a>,
and Information on the stacking of outlines defined in
<a href="https://www.w3.org/TR/CSS21/zindex.html">Appendix E</a>
of Cascading Style Sheets, level 2, revision 1 [[CSS21]]
<li>
<a href="https://www.w3.org/TR/2000/WD-css3-userint-20000216">User Interface for CSS3 (16 February 2000)</a> [[CSS-UI-3]]
</ul>
Note:
<span id="box-model"></span>
<span id="box-sizing"></span>
<span id="propdef-box-sizing"></span>
<span id="valdef-box-sizing-content-box"></span>
<span id="valdef-box-sizing-border-box"></span>
<span id="min-inner-width"></span>
<span id="max-inner-width"></span>
<span id="min-inner-height"></span>
<span id="max-inner-height"></span>
<span id="example-d824f1dc"></span>
<span id="box-sizing-example"></span>
The 'box-sizing' property was previously defined in this section of the specification,
but has been moved to [[CSS-SIZING-3#box-sizing]].
Note:
<span id="text-overflow" caniuse=text-overflow></span>
<span id="propdef-text-overflow"></span>
<span id="overflow-clip"></span>
<span id="overflow-ellipsis"></span>
<span id="overflow-string"></span>
<span id="funcdef-text-overflow-fade"></span>
<span id="issue-ebe65138"></span>
<span id="issue-2e22b1d9"></span>
<span id="issue-948cb1ee"></span>
<span id="valdef-text-overflow-fade"></span>
<span id="example-160d0058"></span>
<span id="bidi-ellipsis"></span>
<span id="ellipsing-details"></span>
<span id="ellipsis-interaction"></span>
<span id="example-44082941"></span>
<span id="text-overflow-examples"></span>
<span id="issue-4b5212a2"></span>
<span id="ellipsis-scrolling"></span>
<span id="example-45d2531f"></span>
<span id="example-347bbb66"></span>
The 'text-overflow' property was previously defined in this section of the specification,
but has been moved to [[CSS-OVERFLOW-3#text-overflow]].
<h3 id="values">
Value Definitions</h3>
This specification follows the <a href="https://www.w3.org/TR/CSS2/about.html#property-defs">CSS property definition conventions</a> from [[!CSS21]]
using the <a href="https://www.w3.org/TR/css-values-3/#value-defs">value definition syntax</a> from [[!CSS-VALUES-3]].
Value types not defined in this specification are defined in CSS Values & Units [[!CSS-VALUES-3]].
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 <a>CSS-wide keywords</a> as their property value.
For readability they have not been repeated explicitly.
<h2 id="outline-props" caniuse="outline">
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 contribute to the [=ink overflow area=] of an element.
<li>Outlines may be non-rectangular.
<li>UAs often render outlines on elements in the '':focus-visible'' state.
</ol>
The outline properties control the style of these dynamic outlines.
The stacking of the rendering of these outlines is explicitly left up to implementations
to provide a better user experience per platform.
This supersedes the stacking of outlines as defined in <a href="https://www.w3.org/TR/CSS21/zindex.html">Appendix E of CSS 2.1</a> [[CSS21]].
<strong class="advisement">
Keyboard users,
in particular people with disabilities
who may not be able to interact with the page in any other fashion,
depend on the outline being visible
on elements in the '':focus-visible'' state,
thus authors must not make the outline invisible on such elements
without making sure an alternative highlighting mechanism is provided.
</strong>
The rendering of applying transforms to outlines is left explicitly undefined.
<h3 id="outline">Outlines Shorthand: the 'outline' property</h3>
<pre class="propdef shorthand">
Name: outline
Value: <<'outline-width'>> || <<'outline-style'>> || <<'outline-color'>>
Applies to: all elements
Inherited: no
Percentages: N/A
</pre>
The 'outline' property is a shorthand property
and sets all three of 'outline-style',
'outline-width',
and 'outline-color'.
In the ambiguous case where
a lone ''outline-style/auto'' value is specified,
or if ''outline-style/auto'' is specified together with an <<'outline-width'>> value,
but without an explicit <<'outline-style'>> or <<'outline-color'>> value,
both 'outline-style' and 'outline-color' are set to ''outine-style/auto''.
Note: The shorthand purposefully omits the 'outline-offset' property,
which determines the position rather than the appearance of the outline,
so that it can cascade independently,
as well as for backwards compatibility reasons.
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.
To the extent that the outline follows the <a>border edge</a>,
it should follow the 'border-radius' curve.
The position of the outline may be affected by descendant boxes.
The dimensions of the drawn outline contribute to the
[=ink overflow area=] of an element.
User agents should use an algorithm for determining
the outline that encloses a region appropriate
for conveying the concept of focus to the user.
Note: This specification does not define the exact position or shape of the outline, but it is typically drawn immediately outside the border box.
Note: The outline is the same on all sides.
In contrast to borders,
there are no ''outline-top'', ''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">
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 shown 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 or selecting a button).
<div class="example">
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-width">
Outline Thickness: the 'outline-width' property</h3>
<pre class="propdef">
Name: outline-width
Value: <<line-width>>
Initial: medium
Applies to: all elements
Inherited: no
Percentages: N/A
Computed value: absolute length, [=snapped as a border width=]; ''0'' if the outline style is ''border-style/none''.
Animation type: by computed value
</pre>
The 'outline-width' property accepts
the same values as 'border-width'
([[css-backgrounds-3#border-width]]),
with the same meaning.
<h3 id="outline-style">
Outline Patterns: the 'outline-style' property</h3>
<pre class="propdef">
Name: outline-style
Value: auto | <<outline-line-style>>
Initial: none
Applies to: all elements
Inherited: no
Percentages: N/A
Computed value: specified keyword
Animation type: by computed value
</pre>
<dfn><<outline-line-style>></dfn> accepts
the same values as <<line-style>>
([[css-backgrounds-3#border-style]])
with the same meaning,
except that
<span class=css>hidden</span> is not a legal outline style.
In addition,
the 'outline-style' property
accepts the value ''outline-style/auto''.
The ''outline-style/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.
User agents may enable authors to influence the rendering of
''outline-style/auto'' style outlines
via the 'outline-color' property,
but this specification does not define how the rendering is impacted (if at all).
The 'outline-width' property is ignored when 'outline-style' is ''outline-style/auto''.
User agents may treat ''outline-style/auto'' as
''outline-style/solid''.
<wpt>
css/css-ui/outline-auto-width-001.html
</wpt>
<h3 id="outline-color">
Outline Colors: the 'outline-color' property</h3>
<pre class="propdef">
Name: outline-color
Value: auto | <<color>> | <<image-1D>>
Initial: auto
Applies to: all elements
Inherited: no
Percentages: N/A
Computed value: see below
Animation type: by computed value
</pre>
The 'outline-color' property
accepts all values of <'border-color'>,
as well as the following keywords:
<dl dfn-type=value dfn-for=outline-color>
<dt><dfn>auto</dfn>
<dd>
When 'outline-style' is ''outline-style/auto'',
''outline-color: auto'' computes to ''outline-style/auto''
and represents the [=accent color=].
Otherwise,
''outline-color: auto'' computes to ''currentColor''.
</dl>
See [[css-color-4#resolving-color-values]]
for the computed value of <<color>> values,
and [[css-images-4#stripes]]
for <<image-1D>> values.
<div id=valdef-outline-color-invert class=note>
Earlier versions of this specification had an additional <code>invert</code> value,
performing a color inversion on the pixels on the screen.
This is no longer supported,
and was removed for lack of implementations
(and of intent to implement)
in modern user agents.
See [[css-ui-3#outline-color]] for details.
</div>
<h3 id="outline-offset">
Offsetting the Outline: the 'outline-offset' property</h3>
By default, the outline is drawn starting just outside the <a>border edge</a>.
However, it is possible to offset the outline and draw it beyond the <a>border edge</a>.
<pre class="propdef">
Name: outline-offset
Value: <<length>>
Initial: 0
Applies to: all elements
Inherited: no
Percentages: N/A
Computed value: absolute length
Animation Type: by computed value
</pre>
If the computed value of 'outline-offset'
is anything other than 0,
then the outline is outset from the <a>border edge</a> by that amount.
<div class="example">
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>
<p id=negative-offset>Negative values must cause the outline
to shrink into the border box.
Both the height and the width of the outside of the shape
drawn by the outline should not become smaller
than twice the computed value of the 'outline-width' property
to make sure that an outline can be rendered
even with large negative values.
User agents should apply this constraint
independently in each dimension.
If the outline is drawn as multiple disconnected shapes,
this constraint applies to each shape separately.
<h2 id="resizing">
<!--maintaining old anchors back from when text-overflow was defined here--><span id="resizing-and-overflow"></span>
Resizing</h2>
CSS2.1 provides a mechanism for controlling the appearance of a scrolling mechanism
(e.g. scrollbars)
on block container elements.
This specification adds a mechanism to that for controlling
user resizability of elements as well as the ability to specify text overflow behavior.
<h3 id="resize" caniuse="css-resize">
Resizing Boxes: the '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.
<pre class="propdef">
Name: resize
Value: none | both | horizontal | vertical | block | inline
Initial: none
Applies to: elements that are <a>scroll containers</a>
and optionally replaced elements such as images, videos, and iframes
Inherited: no
Percentages: N/A
Computed value: specified keyword
Animation type: discrete
</pre>
<dl>
<dt>none
<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.
<dt>both
<dd>
The UA presents a bidirectional resizing mechanism
to allow the user to adjust both the height and the width of the element.
<dt>horizontal
<dd>
The UA presents a unidirectional horizontal resizing mechanism
to allow the user to adjust only the width of the element.
<dt>vertical
<dd>
The UA presents a unidirectional vertical resizing mechanism
to allow the user to adjust only the height of the element.
<dt>block
<dd>
The UA presents a unidirectional [=block-axis=] resizing mechanism
to allow the user to adjust only the [=block size=] of the element.
<dt>inline
<dd>
The UA presents a unidirectional [=inline-axis=] resizing mechanism
to allow the user to adjust only the [=inline size=] of the element.
</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 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,
nor is it related to any UA mechanism for zooming.
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
that are <a>scroll containers</a>.
UAs may also apply it,
regardless of the value of the 'overflow' property,
to:
<ul>
<li>
Replaced elements representing images or videos,
such as <{img}>, <{video}>, <{picture}>, <{svg}>, <{object}>, or <{canvas}>.
<li>
The <{iframe}> element.
</ul>
The effect of the 'resize' property on generated content is undefined.
Implementations should not apply the 'resize' property to generated content.
Note: the 'resize' property may apply to generated content in the future
if there is implementation of <a href="https://drafts.csswg.org/css-pseudo/#CSSPseudoElement-interface">Interface CSSPseudoElement</a>.
When an element is resized by the user,
the user agent sets
the 'width' and 'height' properties
to px unit length values of the size indicated by the user,
in the element’s <a href="https://www.w3.org/TR/css-style-attr/#style-attribute">style attribute</a> DOM,
replacing existing property declaration(s), if any,
without ''!important'', if any.
If an element is resized in only one dimension,
only the corresponding property is set, not both.
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 CSS layout 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 UA should consider the direction of resizing
(as determined by CSS layout),
as well as platform conventions and constraints when deciding
how to convey the resizing mechanism to the user.
The user agent must allow the user to resize the element
with no other constraints than what is imposed by
'min-width', 'max-width', 'min-height', and 'max-height'.
Note: There may be situations in which user attempts to resize an element
appear to be overridden or ignored, e.g. because of ''!important'' cascading declarations that supersede
that element’s <a href="https://www.w3.org/TR/css-style-attr/#style-attribute">style attribute</a>
'width' and 'height' properties in the DOM.
Changes to the computed value of an element's 'resize' property
do not reset changes to the <a href="https://www.w3.org/TR/css-style-attr/#style-attribute">style attribute</a> made due to
user resizing of that element.
<div class="example">
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>
<h2 id="pointing-keyboard">
Pointing Devices and Keyboards</h2>
<h3 id="pointer-interaction">
Pointer interaction</h3>
<h4 id="cursor" caniuse="css3-cursors">
Styling the Cursor: the 'cursor' property</h4>
<pre class="propdef">
Name: cursor
Value: [ [ <<url>> | <<url-set>> ] [<x> <y>]? ]#? <br>
[ auto | default | none |<br>
context-menu | help | pointer | progress | wait | <br>
cell | crosshair | text | vertical-text | <br>
alias | copy | move | no-drop | not-allowed | grab | grabbing | <br>
e-resize | n-resize | ne-resize | nw-resize | s-resize | se-resize | sw-resize | w-resize |
ew-resize | ns-resize | nesw-resize | nwse-resize |
col-resize | row-resize |
all-scroll |<br>
zoom-in | zoom-out <br>
]
Initial: auto
Applies to: all elements
Inherited: yes
Percentages: N/A
Computed value: as specified, except with any relative URLs converted to absolute
Animation type: discrete
</pre>
This property specifies the type of cursor to be displayed for the pointing device
when the cursor's hotspot is within the element's <a>border edge</a>.
Note: As per [[css-backgrounds-3#border-radius]], the <a>border edge</a> is affected by 'border-radius'.
In the case of overlapping elements,
which element determines the type of cursor
is based on hit testing:
the element determining the cursor
is the one that would receive a click
initiated from this position.
Note: The specifics of hit testing
are out of scope of this specification.
Hit testing will hopefully be defined
in a future revision of CSS or HTML.
User agents may ignore the cursor property
over native user agent controls such as scrollbars, resizers, or other native UI widgets
e.g. those that may be used inside some user agent specific implementations of form elements.
User agents may also ignore the 'cursor' property
and display a cursor of their choice
to indicate various states of the UA's user interface,
such as a busy cursor when the page is not responding,
or a text cursor when the user is performing text selection.
Note: [[HTML]] defines <a href="https://html.spec.whatwg.org/multipage/rendering.html#image-maps-2">special handling of image maps</a>
for the 'cursor' property.
Values have the following meanings:
<style>
#cursors dfn { cursor: inherit }
</style>
<dl dfn-type=value dfn-for=cursor id=cursors>
<dt>image cursors
<dd>
The first (optional) component of the 'cursor' property
is a list of image-based cursors.
If the user agent cannot handle the first cursor of a list of cursors,
it must attempt to handle the second, etc.
If the user agent cannot handle any of these author-defined cursors,
it must use the keyword-based cursor at the end of the list.
Each author-defined image-based cursor is defined by the following values:
<dl>
<dt><<url>> | <<url-set>>
<dd>
The user agent retrieves the cursor from the resource designated by the <<url>> or <<url-set>>.
Conforming user agents may, instead of <<url>> and <<url-set>>,
support <<image>> which is a superset.
<dfn type><url-set></dfn> is a limited version of ''image-set()'',
where the <<image>> sub-production is restricted to <<url>> only.
The UA must support the following image file formats:
<ul>
<li>
PNG, as defined in [[!PNG]]
<li>
SVG, as defined in [[!SVG11]],
in <a href="https://www.w3.org/TR/SVG2/conform.html#secure-static-mode">secure static mode</a> [[!SVG2]],
if it has a [=natural size=].
<li>
any other non-animated image file format that they support
for <<image>> in other properties,
such as the 'background-image' property
</ul>
In addition, the UA should support the following image file formats:
<ul>
<li>
SVG, as defined in [[!SVG11]],
in <a href="https://www.w3.org/TR/SVG2/conform.html#secure-animated-mode">secure animated mode</a> [[!SVG2]],
if it has a [=natural size=].
<li>
any other animated image file format that they support
for <<image>> in other properties,
such as the 'background-image' property
</ul>
The UA may also support additional file formats,
including SVG, as defined in [[!SVG11]],
in secure static mode or secure animated mode [[!SVG2]],
even if it does not have a [=natural size=].
Note: The CSS Working Group initially intended support for all SVG,
naturally sized or not.
Support for non-naturally sized SVG was downgraded from mandatory to optional due
to lack of implementations.
Note: For a number of years,
the only file formats supported for cursors in common desktop browsers were
the .ico and .cur file formats, as designed by Microsoft.
Although this is no longer the case
(PNG and SVG have broad support),
for compatibility with legacy content,
UAs are encouraged to support these,
even though the lack of an open specification
makes it impossible to have a normative requirement
about these formats.
Some information on these formats can be found
<a href="https://en.wikipedia.org/wiki/ICO_%28file_format%29">on Wikipedia</a>.
The <a>default object size</a> for cursor images is
a UA-defined size that should be based on
the size of a typical cursor on the UA's operating system.
The <a>concrete object size</a> is determined using
the <a>default sizing algorithm</a>.
If an operating system is
<strong>incapable</strong> of rendering a cursor above a given size,
cursors larger than that size must be shrunk to within
the OS-supported size bounds,
while maintaining the cursor image's [=natural aspect ratio=], if any.
The optional <x> and <y> coordinates
identify the exact position within the image which is the pointer position (i.e., the hotspot).
<dt><x>
<dt><y>
<dd>
Each is a <<number>>.
The x-coordinate and y-coordinate of the position
in the cursor's coordinate system (left/top relative)
which represents the precise position that is being pointed to.
Note: This specification does not define
how the coordinate systems of the various types of <<image>> are established,
and defers these definitions to [[CSS-IMAGES-4]].
If the values are unspecified,
then the natural hotspot defined inside the image resource itself is used.
If both the values are unspecific and the referenced cursor has no defined hotspot,
the effect is as if a value of "0 0" was specified.
If the coordinates of the hotspot,
as specified either inside the image resource or
by <x> and <y> values,
fall outside of the cursor image,
they must be clamped (independently) to fit.
</dl>
<dt>general purpose cursors
<dd>
<dl>
<dt style="cursor:auto"><dfn>auto</dfn>
<dd>
The UA determines the cursor to display based on the current context.
Specifically, ''cursor/auto'' behaves as ''cursor/text'' over selectable text or editable elements,
and ''cursor/default'' otherwise.
Note: When over selectable text or editable elements,
as it does with ''cursor/text'',
the UA must use a vertical or horizontal text cursor,
as appropriate for the [=writing mode=] of the element,
and may take transforms and other visual effects into account as well.
<dt style="cursor:default"><dfn>default</dfn>
<dd>
The platform-dependent default cursor.
Often rendered as an arrow.
<dt style="cursor:none"><dfn>none</dfn>
<dd>
No cursor is rendered for the element.
</dl>
<dt>links and status cursors
<dd>
<dl>
<dt style="cursor:context-menu"><dfn>context-menu</dfn>
<dd>
A context menu is available for the object under the cursor.
Often rendered as an arrow with a small menu-like graphic next to it.
<dt style="cursor:help"><dfn>help</dfn>
<dd>
Help is available for the object under the cursor.
Often rendered as a question mark or a balloon.
<dt style="cursor:pointer"><dfn>pointer</dfn>
<dd>
The cursor is a pointer that indicates a link.
Often rendered as the backside of a hand with the index finger extended.
Unless otherwise specified,
UAs must apply ''cursor: pointer'' to hyperlinks
for all supported document formats
via the <a lt="User-Agent Origin">UA stylesheet</a>,
using a normal (i.e. not ''!important'') declaration.
Authors should use pointer on links and may use on other interactive elements.
<dt style="cursor:progress"><dfn>progress</dfn>
<dd>
A progress indicator. The program is performing some processing,
but is different from ''wait'' in that the user may still interact
with the program. Often rendered as a spinning beach ball,
or an arrow with a watch or hourglass.
<dt style="cursor:wait"><dfn>wait</dfn>
<dd>
Indicates that the program is busy and the user should wait.
Often rendered as a watch or hourglass.
</dl>
<dt>selection cursors
<dd>
<dl>
<dt style="cursor:cell"><dfn>cell</dfn>
<dd>
Indicates that a cell or set of cells may be selected.
Often rendered as a thick plus-sign with a dot in the middle.
<dt style="cursor:crosshair"><dfn>crosshair</dfn>
<dd>
A simple crosshair (e.g., short line segments resembling a "+" sign).
Often used to indicate a two dimensional bitmap selection mode.
<dt style="cursor:text"><dfn>text</dfn>
<dd>
Indicates text that may be selected. Often rendered as an I-beam.
User agents must automatically display
a vertical I-beam/cursor over elements with a horizontal [=writing mode=],
and a horizontal I-beam/cursor
(e.g. same as the ''vertical-text'' keyword)
over elements in a vertical [=writing mode=].
Additionally, user agents may take transforms (see [[CSS-TRANSFORMS-1]])
or other visual effects such as text on a path (See [[SVG2/text#TextLayoutPath]]),
when choosing between the horizontal or vertical text cursor,
and may display any angle of I-beam/cursor for text that is rendered at any particular angle.
<dt style="cursor:vertical-text"><dfn>vertical-text</dfn>
<dd>
Indicates vertical-text that may be selected.
Often rendered as a horizontal I-beam.
</dl>
<dt>drag and drop cursors
<dd>
<dl>
<dt style="cursor:alias"><dfn>alias</dfn>
<dd>
Indicates an alias of/shortcut to something is to be created.
Often rendered as an arrow with a small curved arrow next to it.
<dt style="cursor:copy"><dfn>copy</dfn>
<dd>
Indicates something is to be copied.
Often rendered as an arrow with a small plus sign next to it.
<dt style="cursor:move"><dfn>move</dfn>
<dd>
Indicates something is to be moved.
<dt style="cursor:no-drop"><dfn>no-drop</dfn>
<dd>
Indicates that the dragged item cannot be dropped at the current cursor location.
Often rendered as a hand or pointer with a small circle with a line through it.
<dt style="cursor:not-allowed"><dfn>not-allowed</dfn>
<dd>
Indicates that the requested action will not be carried out.
Often rendered as a circle with a line through it.
<dt caniuse="css3-cursors-grab" id=cursor-grab style="cursor:grab"><dfn>grab</dfn>
<dd>
Indicates that something can be grabbed (dragged to be moved).
Often rendered as the backside of an open hand.
<dt style="cursor:grabbing"><dfn>grabbing</dfn>
<dd>
Indicates that something is being grabbed (dragged to be moved).
Often rendered as the backside of a hand with fingers closed mostly out of view.
</dl>
<dt>resizing and scrolling cursors
<dd>
<dl>
<dt>
<span style="cursor:e-resize"><dfn>e-resize</dfn></span>,
<span style="cursor:n-resize"><dfn>n-resize</dfn></span>,
<span style="cursor:ne-resize"><dfn>ne-resize</dfn></span>,
<span style="cursor:nw-resize"><dfn>nw-resize</dfn></span>,
<span style="cursor:s-resize"><dfn>s-resize</dfn></span>,
<span style="cursor:se-resize"><dfn>se-resize</dfn></span>,
<span style="cursor:sw-resize"><dfn>sw-resize</dfn></span>,
<span style="cursor:w-resize"><dfn>w-resize</dfn></span>
<dd>
Indicates that some edge is to be moved.
For example, the ''se-resize'' cursor is used
when the movement starts from the south-east corner of the box.