What is CSS for monospacing like <kbd> provides?

1 answer

This was chosen as the best answer

<KBD> indicates characters that should be typed in at a keyboard. <KBD> is rendered in a fixed width font.

Depending on what browser is rendering the object, the CSS code to duplicate the styles would vary, but all you really want to make sure is that it's being rendered in fixed-width and plain black, right?

kbd {
font-style: normal;
font-weight: normal;
font-variant: normal;
font-family:'Andale Mono', 'Courier New', 'Courier', 'Lucidatypewriter', Fixed, monospace;
Answered over 9 years ago by Gary Hepting
  • You might want to add font-size:15px; as well if you want it the same as Firefox' default rendering :) Gary Hepting over 9 years ago
  • "font-family:Fixed, monospace;" is what I was looking for. C.W.Holeman II over 9 years ago
  • Yeah, those are the only values you need. The others are just good to keep the preferred font on various platforms :) Gary Hepting over 9 years ago