The spec suggests that <kbd> and <samp> elements can be nested in different ways to represent different things.

   
http://www.whatwg.org/specs/web-apps/current-work/multipage/section-phrase.html#the-kbd

This was discussed on IRC:

   http://krijnhoetmer.nl/irc-logs/whatwg/20070615#l-294


Summary:

 * UAs can't do anything useful with the information.

 * The reader can understand the intent by the context.

 * A single level of either <kbd> or <samp> is enough for common styling
   needs. Even if it isn't, a class on the outermost element is more
   helpful due to lack of parent selectors in CSS.

 * It's extremely verbose. Compare:

     <kbd>File</kbd> > <kbd>Exit</kbd>

   ...with:

     <kbd><kbd><samp>File</samp></kbd> > <kbd><samp>Exit</samp></kbd></kbd>

 * Fiddly markup inevitably causes confusion and is easier to get wrong.

 * People can nest the elements if they like (e.g. for more complex
   styling) without this being required. An example might be a page that
   contains both text to be entered and keys to be pressed, with those
   being styled differently.

 * <kbd> is already used in the wild to represent keys to be pressed.

--
Simon Pieters

Reply via email to