CSS basic user interface

The CSS basic user interface module lets you define the rendering and functionality of features related to the user interface including outline properties, visual feedback to pointing device and keyboard, and altering the default appearance of UI widgets.

Basic user interface properties can be used to improve user experience and accessibility by providing visual cues to elements that are being interacted with, including styling mouse cursors and keyboard directional focus navigation, and styling caret cursors when an editable element has focus. The module provides for providing outlines to focused (or not) elements without impacting an element's box model dimensions and styling. This UI module also enables the styling of user interface controls.

Basic user interface in action

To view how basic user interface properties can alter the appearance of UI features, interact with the elements in this sample. Note that some features in this sample improve usability while others harm user experience.

The CSS outline and outline-offset properties were used to provide feedback to users which element currently has focus. An accent-color provides a theme color to all the form controls. The caret that appears when the text is edit has the same color thanks to the caret-color property. These can all be considered UI improvements.

Some features harm usability. The cursor property was used to change cursors from the browser default which is confusing. The resize property prevents the second <textarea> from being resizable while the pointer-events property prevents the third <textarea> from receiving click events. It is still focusable using the keyboard.

To see the code for this basic user interface sample, view the source on GitHub.




Learn forms: advanced form styling

Explains how appearance can be used to style form controls.


CSS Basic User Interface Module Level 4

See also