Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 44 additions & 5 deletions css-forms-1/Overview.bs
Original file line number Diff line number Diff line change
Expand Up @@ -837,36 +837,75 @@ select {

## Sliders ## {#stylesheet-sliders}

ISSUE: Refine meter, progress, switch and range input styling.
ISSUE(12267): Refine meter, progress, switch and range input styling.

```css
input[type="checkbox][switch],
input[type="range"] {
display: inline-flex;
position: relative;
align-items: center;
inline-size: 100%;
}

input[type="checkbox"][switch]::slider-track,
input[type="range"]::slider-track,
meter::slider-track,
progress::slider-track {
height: 1em;
block-size: 1em;
inline-size: 100%;
}

input[type=range]::slider-track {
block-size: 0.5em;
}

input[type=checkbox][switch]::slider-track {
border-radius: 1em;
}

input[type="checkbox"][switch]::slider-fill,
input[type="range"]::slider-fill,
meter::slider-fill,
progress::slider-fill {
height: 100%;
block-size: 100%;
background-color: currentColor;
}

progress:indeterminate::slider-fill {
inline-size: 0;
}

input[type="range"]::slider-fill,
input[type=checkbox][switch]::slider-fill {
background-color: color-mix(currentColor 25%, transparent);
border-radius: inherit;
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really sure if this should be needed, for my range input prototype it isn't but for switch it seems to be else the fill overflows the track.

We can adjust accordingly in future if it's not needed.


block-size: 100%;
}

input[type=checkbox][switch]::slider-fill {
inline-size: 0%;
}

input[type="checkbox"][switch]:checked::slider-fill {
inline-size: 100%;
}

input[type="checkbox"][switch]::slider-thumb,
input[type="range"]::slider-thumb {
border-radius: 0;
border: none;
background-color: currentColor;
appearance: none;
width: 1em;
height: 100%;
inline-size: 1em;
block-size: 1em;
border-radius: 100%;
position: absolute;
}

input[type=checkbox][switch]:checked::slider-thumb {
inset-inline-end: 0;
}
```

Expand Down
Loading