- Adding a Paragraph
- Specifying Fine Print
- Marking Important and Emphasized Text
- Creating a Figure
- Indicating a Citation or Reference
- Quoting Text
- Specifying Time
- Explaining Abbreviations
- Defining a Term
- Creating Superscripts and Subscripts
- Adding Author Contact Information
- Noting Edits and Inaccurate Text
- Marking Up Code
- Using Preformatted Text
- Highlighting Text
- Creating a Line Break
- Creating Spans
- Other Elements
Marking Up Code
If your content contains code samples or file names, the code element is for you ( and ).
The code element indicates that the text is code or a file name. If your code needs to display < or > signs, use the < and > character entities, respectively (see the last tip). Here, the second instance of code demonstrates this. If you were to use < and >, the browser would treat your code as an HTML element, not as text to display.
The code element’s text even looks like code because of the monospaced default font.
The examples show code used in a sentence. To show a standalone block of code (outside of a sentence), wrap the code element with a pre element to maintain its formatting (see “Using Preformatted Text” for an example).
To mark up code or a file name
- Type <code>.
- Type the code or file name.
- Type </code>.