Horje
How to create HTML <code> For Computer Code Part - 2

Notice that the <code> element does not preserve extra whitespace and line-breaks.


Example of HTML <code> For Computer Code Part - 2

To fix this, you can put the <code> element inside a <pre> element:
index.html
Example: HTML
<!DOCTYPE html>
<html>
<body>

<p>The code element does not preserve whitespace and line-breaks.</p>
<p>To fix this, you can put the code element inside a pre element:</p>

<pre>
<code>
x = 5;
y = 6;
z = x + y;
</code>
</pre>

</body>
</html>

Output should be:

Example of HTML <code> For Computer Code Part - 2





Category:
Web Tutorial
Sub Category:
HTML Computer Code
Uploaded by:
Admin


Read Article
https://develop.horje.com/learn/1434/reference