Skip to content

Commit 02fb20b

Browse files
committed
[css-forms-1] Add initial UA styles for switch
1 parent 31df7a5 commit 02fb20b

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

‎css-forms-1/Overview.bs

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -813,13 +813,25 @@ select {
813813

814814
## Sliders ## {#stylesheet-sliders}
815815

816-
ISSUE: Refine meter, progress, switch and range input styling.
816+
ISSUE(12267): Refine meter, progress, switch and range input styling.
817817

818818
```css
819+
input[type=checkbox][switch] {
820+
display: inline-flex;
821+
position: relative;
822+
align-items: center;
823+
width: 2em;
824+
}
825+
819826
::slider-track {
820827
height: 1em;
821828
}
822829

830+
input[type=checkbox][switch]::slider-track {
831+
width: 100%;
832+
border-radius: 1em;
833+
}
834+
823835
::slider-fill {
824836
height: 100%;
825837
background-color: currentColor;
@@ -829,6 +841,11 @@ ISSUE: Refine meter, progress, switch and range input styling.
829841
inline-size: 0;
830842
}
831843

844+
input[type=checkbox][switch]::slider-fill {
845+
background-color: transparent;
846+
border-radius: inherit;
847+
}
848+
832849
::slider-thumb {
833850
border-radius: 0;
834851
border: none;
@@ -837,6 +854,16 @@ ISSUE: Refine meter, progress, switch and range input styling.
837854
width: 1em;
838855
height: 100%;
839856
}
857+
858+
input[type=checkbox][switch]::slider-thumb {
859+
border-radius: 100%;
860+
height: 1em;
861+
position: absolute;
862+
}
863+
864+
input[type=checkbox][switch]:checked::slider-thumb {
865+
inset-inline-end: 0;
866+
}
840867
```
841868

842869
## Checkboxes & radios ## {#stylesheet-checkbox-radio}

0 commit comments

Comments
 (0)