Skip to content

Commit bb1a516

Browse files
committed
[css-forms-1] Add UA style rules for text fields
1 parent fc18e62 commit bb1a516

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

css-forms-1/Overview.bs

+50
Original file line numberDiff line numberDiff line change
@@ -696,6 +696,56 @@ input[type=radio]:checked::checkmark {
696696
width: 100%;
697697
}
698698
```
699+
700+
## Text fields
701+
702+
```css
703+
input:not([type]),
704+
input:is([type=text], [type=search], [type=email], [type=password], [type=tel], [type=url], [type=number]),
705+
textarea {
706+
display: inline-grid;
707+
padding-inline: 2px;
708+
field-sizing: content;
709+
}
710+
711+
input:not([type]),
712+
input:is([type=text], [type=search], [type=email], [type=password], [type=tel], [type=url], [type=number]) {
713+
overflow-x: auto;
714+
scrollbar-width: none;
715+
padding-block: 2px;
716+
height: calc(1lh + 2px + 2px);
717+
width: calc(20ch + 4px + 2px);
718+
}
719+
720+
textarea {
721+
overflow-y: auto;
722+
padding-block: 2px;
723+
resize: both;
724+
height: calc(2lh + 4px + 2px);
725+
width: calc(22ch + 4px + 2px);
726+
}
727+
728+
::placeholder {
729+
color: color-mix(in srgb, currentColor 50%, transparent);
730+
display: none;
731+
line-break: anywhere;
732+
grid-area: 1/1;
733+
}
734+
735+
:placeholder-shown::placeholder {
736+
display: block;
737+
}
738+
739+
::field-text {
740+
grid-area: 1/1;
741+
/* Should be cursor width but that's not exposed */
742+
min-width: 1px;
743+
min-height: 1lh;
744+
height: 100%;
745+
width: 100%;
746+
}
747+
```
748+
699749
## Selects & buttons
700750

701751
```css

0 commit comments

Comments
 (0)