Code Block Element

The code block element contains long portions of code. This element is helpful for providing sample code in steps or as reference material.

Guidelines

  • Use the code block element to contain two or more lines of code that must be set off from the main flow of text
  • Limit the use of the code block element to within task topics and reference topics
  • Indent and space code correctly
Tip: You can add snippets of code within the main flow of text using the code phrase element. For more information, see Code Phrase Element.

Example

<!DOCTYPE html> <html> <body> <h1>My First Heading</h1> <p>My first paragraph.</p> </body>