HTML - Code element

1 - About

The code element represents a fragment of computer code.

By default, the content text is displayed using the user agent's default monospace font.

3 - Example

The following example shows how the element can be used in a paragraph to mark up element names and computer code, including punctuation.


<p>The <code>code<code> element represents a fragment of computer
code.</p>

<p>When you call the <code>activate()<code> method on the
<code>robotSnowman<code> object, the eyes glow.</p>

<p>The example below uses the <code>begin<code> keyword to indicate
the start of a statement block. It is paired with an <code>end<code>
keyword, which is followed by the <code>.<code> punctuation character
(full stop) to indicate the end of the program.</p>


The following example shows how a block of code could be marked up using the pre and code elements.


<pre><code class="language-pascal">var i: Integer;
begin
   i := 1;
end.<code></pre>

A class is used in that example to indicate the language used.

4 - Prettifying / Syntax Highlighting

Prettifying can be done by the client through JavaScript library:

5 - Documentation / Reference


Data Science
Data Analysis
Statistics
Data Science
Linear Algebra Mathematics
Trigonometry

Powered by ComboStrap