The kbd element makes text look like a button on the keyboard (perhaps not skeuomorphically, but at least figuratively). Inside of a content element, it is applied to the
<kbd> tag automatically.
It applies a dark background and a monospace font.
Spacing — Unless used inside a content element, the kbd element defines no margin. That means that you’ll need to manually position it inside your layout.
Beyond customization, the kbd element has no variants.
Use with kbd (
<kbd>) elements. Using the
.kbd element on
<kbd> tags will help screenreaders and other assistive technologies better represent your content.
Don't use color to communicate. Instead, use color to support information you communicate through text. When this isn't possible, be sure to use a
Be mindful of contrast. What looks good to you may not be readable for others. Text contrast is a good thing!
Support all navigation modes. Some people will interact with your interface using assitive technologies and/or a keyboard. Build your interface with these different modes in mind (for example, by setting the `tab-index` attribute on all interactive elements that aren't interactive by default).