2.14 Code-Related Elements

As a programmer, you’ll sometimes want to look up coding syntax and coding examples on the Web. It’s amazing how much code is out there. To accommodate web developers who want to make web pages that show code, the HTML5 standard provides several coding-related elements—code, kbd, samp, and var.

The code element indicates that its enclosed text is programming code. The kbd element indicates that its enclosed text represents input for a program. The “kbd” stands for “keyboard.” The samp element indicates that its enclosed text represents output for a program. The “samp” stands for “sample.” The var element indicates that its enclosed text represents a programming variable or a mathematical variable. The “var” stands ...

Get Web Programming with HTML5, CSS, and JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.