Sign in to follow this  
namingway

[web] HTML help

Recommended Posts

I don't quite understand what the following do; <code>Computer code</code> <kbd>Keyboard input</kbd> Teletype text <samp>Sample text</samp> <var>Computer variable</var> I'm guessing there self explanitory but I still don't get how they can be used.

Share this post


Link to post
Share on other sites
They indicate that the text enclosed in them represents computer code, keyboard input, teletype text, sample text, or a variable (respectively). Many computer books will use different typographical styles for those types of text, and they'll tell you about them towards the beginning. They exist in HTML to preserve semantics for screenreaders and other software (that wouldn't know that something enclosed in <font face="Courier"> is a code example), and so that those types of text have consistent styling (which you can specify with CSS).

Share this post


Link to post
Share on other sites
Adding to Igni's response, see http://www.w3.org/TR/html401/struct/text.html#h-9.2.1 for details.

For example, you can have a CSS style such as ...

kbd { background-color: silver; border-style: outset; }

... so that each <kbd> element is displayed looking like a keyboard button.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this