Example

Computer Code in HTML

HTML

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Computer Code HTML</title>
</head>
<body>

<!-- 
    Number of elements available for marking up computer code in HTML: 
    <code>: marking up generic pieces of computer code.    
    <pre>: retaining whitespace (The Preformatted Text). 
    <var>: specifically marking up variable names.
    <kbd>: marking up keyboard input entered into the computer.
    <samp>: marking up the output of a computer program.       
-->

    <p>
        SKILL
        ZAM
    </p>

    <pre>
        SKILL 
        ZAM
    </pre>

    <hr>

    <pre>
        L          TE
            A       A
            C    V
                R A
                DOU
                LOU
            REUSE
            QUE TU
            PORTES
            ET QUI T'
            ORNE O CI
            VILISÉ
            OTE-  TU VEUX
            LA    BIEN
            SI      RESPI
                    RER       - Apollinaire
    </pre>
        
    <hr>

    <pre><code>const para = document.querySelector('p');

    para.onclick = function() {
        alert('Owww, stop poking me!');
    }</code></pre>
            
    <p>In the above JavaScript example, <var>para</var> represents a paragraph element.</p>
            
    <hr>

    <pre>$ <kbd>ping google.com</kbd>
        <samp> 
            Pinging google.com [142.250.192.14] with 32 bytes of data:
            Reply from 142.250.192.14: bytes=32 time=29ms TTL=117
            Reply from 142.250.192.14: bytes=32 time=28ms TTL=117
            Reply from 142.250.192.14: bytes=32 time=29ms TTL=117
            Reply from 142.250.192.14: bytes=32 time=29ms TTL=117
            
            Ping statistics for 142.250.192.14:
                Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
            Approximate round trip times in milli-seconds:
                Minimum = 28ms, Maximum = 29ms, Average = 28ms
        </samp>
    </pre>

    <hr>

</body>
</html>

Output

View original