Code Formatting Examples

Use semantic HTML elements to make code snippets and multi-line examples easier to read.

Inline code

Wrap a short snippet, element name, or command within <code> tags. This is useful when code appears within a sentence.

For example, use <section> to identify an HTML section element inline.

For example, <code><section></code> should be wrapped as inline.

Code blocks

Use <pre> for code or text that spans multiple lines. Escape angle brackets so the example displays correctly in the browser.

<pre>
  <p>Sample text here...</p>
</pre>

Keep the contents of a <pre> element aligned close to the left edge. Preformatted blocks preserve spaces, tabs, and line breaks.

For longer examples, the .pre-scrollable class can be used to set a maximum height of 350px and add a vertical scrollbar.

Back to Top
Product has been added to your cart
Compare (0)