You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Editorial review: Document customizable <select> elements (mdn#38470)
* Document customizable <select> elements
* fix typo
* Finish guide
* correct info about how <selectedcontent> is populated
* add links to customizable select guide, update existing pages, remove unneeded links
* Document selectedcontent element
* Add doc for ::picker()
* Document appearance: base-select, tweak :open and :checked ref pages
* Document the ::picker-icon and ::checkmark pseudos
* Add notes on implicit popover-invoker relationship and anchor reference
* Add default picker styling info, tweak other info
* Fixes for josepharhar review comments
* Fixes for josepharhar review comments
* Fixes for scottaohara review comments
* Accessibility and <select> content fixes
* Additional fixes
* Additional fixes
* Additional fixes
* Fixes for hamishwillee review comments
* Change other elements back to other content
* Last few tweaks from hamishwillee review
In this article, we will see what can be done with CSS to style the types of form control that are more difficult to style — the "bad" and "ugly" categories. As we saw [in the previous article](/en-US/docs/Learn_web_development/Extensions/Forms/Styling_web_forms), text fields and buttons are perfectly easy to style; now we will dig into styling the more problematic bits.
10
10
@@ -38,6 +38,8 @@ To recap what we said in the previous article, we have:
38
38
**The ugly**: Some elements can't be styled thoroughly using CSS. These include:
39
39
40
40
- Elements involved in creating dropdown widgets, including {{HTMLElement("select")}}, {{HTMLElement("option")}}, {{HTMLElement("optgroup")}} and {{HTMLElement("datalist")}}.
41
+
> [!NOTE]
42
+
> Some browsers now support [Customizable select elements](/en-US/docs/Learn_web_development/Extensions/Forms/Customizable_select), a set of HTML and CSS features that together enable full customization of `<select>` elements and their contents just like any regular DOM elements.
@@ -367,9 +369,9 @@ Let's talk about some specifics of each of these types of control, highlighting
367
369
368
370
### Selects and datalists
369
371
370
-
In modern browsers, selects and datalists are generally not too bad to style provided you don't want to vary the look and feel too much from the defaults.
372
+
Some browsers now support [Customizable select elements](/en-US/docs/Learn_web_development/Extensions/Forms/Customizable_select), a set of HTML and CSS features that together enable full customization of `<select>` elements and their contents just like any regular DOM elements. In supporting browsers and codebases, you no longer need to worry about the legacy techniques described below for `<select>` elements.
371
373
372
-
We've managed to get the basic look of the boxes looking pretty uniform and consistent. The datalist control is `<input type="text">` anyway, so we knew this wouldn't be a problem.
374
+
Styling datalists and selects (in browsers that don't support customizable selects) allows an acceptable level of customization provided you don't want to vary the look and feel too much from the defaults. We've managed to get the basic look of the boxes looking pretty uniform and consistent. The datalist invoking control is an`<input type="text">` anyway, so we knew this wouldn't be a problem.
373
375
374
376
Two things are slightly more problematic. First of all, the select's "arrow" icon that indicates it is a dropdown differs across browsers. It also tends to change if you increase the size of the select box, or resize in an ugly fashion. To fix this in our example we first used our old friend `appearance: none` to get rid of the icon altogether:
375
377
@@ -508,17 +510,10 @@ You can see the result of the above CSS styling in the below live example (see a
508
510
509
511
It is easier to just create your own custom solution for these features, if you want to be able to control the styling, or use a third-party solution such as [progressbar.js](https://kimmobrunfeldt.github.io/progressbar.js/#examples).
510
512
511
-
The article [How to build custom form controls](/en-US/docs/Learn_web_development/Extensions/Forms/How_to_build_custom_form_controls) provides an example of how to build a custom designed select with HTML, CSS, and JavaScript.
512
-
513
513
## Summary
514
514
515
515
While there are still difficulties using CSS with HTML forms, there are ways to get around many of the problems. There are no clean, universal solutions, but modern browsers offer new possibilities. For now, the best solution is to learn more about the way the different browsers support CSS when applied to HTML form controls.
516
516
517
-
In the next article of this module, we will explore the different [UI pseudo-classes](/en-US/docs/Learn_web_development/Extensions/Forms/UI_pseudo-classes) available to us in modern browsers for styling forms in different states.
In the next article of this module, we will explore creating [fully-customized `<select>` elements](/en-US/docs/Learn_web_development/Extensions/Forms/Customizable_select) using the dedicated, modern HTML and CSS features available for this purpose.
522
518
523
-
-[How to build custom form controls](/en-US/docs/Learn_web_development/Extensions/Forms/How_to_build_custom_form_controls)
524
-
-[Sending forms through JavaScript](/en-US/docs/Learn_web_development/Extensions/Forms/Sending_forms_through_JavaScript)
Copy file name to clipboardExpand all lines: files/en-us/learn_web_development/extensions/forms/basic_native_form_controls/index.md
-5Lines changed: 0 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -415,8 +415,3 @@ You've reached the end of this article, but can you remember the most important
415
415
This article has covered the older input types — the original set introduced in the early days of HTML that is well-supported in all browsers. In the next section, we'll take a look at the more modern values of the `type` attribute.
0 commit comments