john c. j. john c. j. - 7 months ago 20
HTML Question

HTML tag for user interface elements

I know about

code
and
kbd
tags. But is there a tag for user interface elements? To write markup like this:

<p>Then you should press <kbd>Enter</kbd> key or just press <ui>OK</ui> button.</p>


Also for window titles, checkboxes, radio buttons etc.

Answer

Is there a tag for user interface elements?

The appropriate element for marking up user input is <kbd>.

From the spec

The <kbd> element represents user input (typically keyboard input, although it may also be used to represent other input, such as voice commands).

Emphasis mine

So your example would be appropriately marked up using:

<p>Then you should press <kbd>Enter</kbd> key or just press <kbd>OK</kbd> button.</p>
Comments