Form Styling (part 2) (9-9-2026) | CIS311
Overview
Kenan Casey demonstrates modern CSS techniques for styling form controls: replacing a select element’s native chevron with a positioned SVG, adjusting checkbox and radio layouts, and styling validation states. The examples use logical sizing properties, `accent-color`, `fieldset` and flexbox layout, plus `:user-invalid` and `:user-valid` to provide feedback only after interaction.
Key takeaways
- Setting `appearance: none` on a select removes its native chevron, allowing a custom SVG background to control the icon’s position and size.
- The `select::picker` and `appearance: base-select` approach can expose styling options for the opened menu, but browser support is limited.
- Logical properties such as `inline-size` and `block-size` provide width- and height-equivalent sizing while supporting different writing modes.
- Applying `accent-color: var(--brand)` gives checked radio buttons and checkboxes the site’s brand color without building custom controls from scratch.
- For validation feedback, `:user-invalid` avoids showing errors on untouched fields, while `:user-valid` can mark correctly completed fields.
Chapters
- Style the `select` control’s padding, border, border radius, background color, and font size.
- Set `appearance: none` to remove the browser’s native dropdown chevron.
- Create a `chevron-down.svg` asset and use it as a CSS background image for a custom indicator.
- Use `background-repeat: no-repeat` and `background-position` to place the SVG at the right side of the select.
- Adjust the icon’s size and offset with `background-size` and background positioning.
- Explore `select::picker` with `appearance: base-select` to style the opened picker; Casey notes support is limited, including Chrome and Safari.
- Select both control types with attribute selectors: `input[type="checkbox"]` and `input[type="radio"]`.
- Set `inline-size` and `block-size` to `1.5rem`, remove padding, and apply the brand color with `accent-color: var(--brand)`.
- Use a grid layout and `gap` on `fieldset`, then make each `.choice` a flex row with spacing and centered alignment.
- Style choice labels at font weight 400 and emphasize the `legend` at weight 600; retain a border around the fieldset.
- Required fields trigger the browser’s built-in validation on submission without JavaScript.
- Avoid `input:invalid` for immediate error styling because required, empty fields appear invalid before the user starts the form.
- Use `input:user-invalid` to apply a warning-colored border after interaction, and `input:user-valid` to apply a brand-colored border once the value is valid.
Transcript excerpt
0:00 So, we're continuing on our journey into styling forms using modern CSS, and I wanted to show you a couple tricks on the select drop-down box. Um This is something we can do. We can remove the native styling of this checkbox No, this drop-down. And be in control of ourselves. And that includes uh even includes the chevron. You see this little chevron guy here? >> [clears throat] >> So, uh to do that, we write a selector called select. Um
0:47 And let's take a look at this. I'm going to say padding inline, which would be left and right. Um actually, let me just Let's see. I'm going to put put a padding of 2 rem. Okay. So, we can style the padding here. Um Wait, did we already do that? Yes. Yes. So, I already put padding, border, border radius, background color, and font size into this. I do not like that. I do not like that. Um I would like another color for the background of the boxes. I'm going to call it semi-muted.
1:37 Which is Which direction do I want to go? Uh 80% And on these guys, I would like this to not be service but semi-muted. Um no, I think I'm going to go the other direction. Hang on. Let me see what my what's 50% look like. 40%? I don't know. I think it should look different. 30%? Mhm. Okay.
2:26 Going back here to select. So we put the basic styling in before for this guy. What CSS will allow us to do is opt out of even this little chevron and we can be in control of of that as well. And to do that, you say appearance appearance colon none. And when you say appearance colon none, then you don't even have that drop down
This is the start of the transcript. Save this video free for the whole transcript, searchable and time-coded.
In this course
Related notes
Summary, takeaways, and chapters were generated by AI from the video's transcript and may contain errors. The video belongs to its creator, Kenan Casey.