Styling the controls the browser draws in CSS
Some parts of a form control are yours to style and some belong to the browser.
:root { accent-color: #2b6cb0; }
.select {
appearance: none;
padding: 0.5rem 2rem 0.5rem 0.75rem;
border: 1px solid #cbd5e1;
border-radius: 0.375rem;
background: url("/img/chevron.svg") no-repeat right 0.6rem center;
}
.input:user-invalid { border-color: #dc2626; }
.input:placeholder-shown { font-style: italic; }
.grow {
field-sizing: content;
min-block-size: 3lh;
}
How it works
accent-colorrecolors checkboxes, radios and range without a rebuild.appearance: nonehands you the whole control, borders and arrow included.field-sizing: contentlets a textarea grow with what is typed into it.
Keywords and builtins used here
appearancebackgroundbordercontentgrowinputpaddingpxremselecturl
The run, in numbers
- Lines
- 17
- Characters to type
- 371
- Tokens
- 84
- Three-star pace
- 85 tpm
At the three-star pace of 85 tokens a minute, this run takes about 59 seconds.
Step 2 of 2 in Controls, step 2 of 13 in Styling components.