Displaying Computer HTML Code and Output

Text relating to computer input and output codes are displayed using a set of elements designed for the purpose, which usually renders the text in the browser’s default monospaced font. This is a font in which letters and characters occupy the same amount of space. It is different from variable- width fonts, such as the one used in this text, in which the widths of letters vary. The elements include <code>, <samp>, and <kbd>, which are listed in Table 3.3. Figure 3.26 shows how they are used, and Figure 3.27 depicts the result.


Which of the following elements would you use to present the sequence required to perform a word-processing task: <code> <kbd> or <samp>?

Source: Sklar David (2016), HTML: A Gentle Introduction to the Web’s Most Popular Language, O’Reilly Media; 1st edition.

Leave a Reply

Your email address will not be published. Required fields are marked *