The following CSS rule simulates the look and behaviour of the HTML code element.
.code {
font-family: monospace;
}
A live example:
Using the HTML element <code>
HTML:
<code>
Console.WriteLine("Hello");
</code>
HTML output:
Console.WriteLine("Hello");
Using the above CSS class .code
HTML:
<div class="code">
Console.WriteLine("Hello");
</div>
HTML output: