Code Markup in HTML
You can use the <code>
element to mark up code in HTML.
index.html
9
1
2
<p>To display a message in the console, you can use the following code:</p>
<pre><code>console.log("Hello, world!");</code></pre>
Notice that the <code>
element is nested inside the <pre>
element. The <pre>
element represents preformatted text and is typically displayed in a fixed-width font to preserve both spaces and line breaks.
You can also use the <code>
element to mark up inline code like this:
index.html
9
1
2
3
4
<p>
To display a message in the console, you can use the
<code>console.log()</code> function.
</p>
You can also use the <kbd>
element to mark up keyboard input. The <kbd>
element represents user input and is typically displayed in a monospace font to distinguish it from regular text.
index.html
9
1
<p>To save the file, press <kbd>Ctrl</kbd>+<kbd>S</kbd>.</p>
Tout était clair ?
Merci pour vos commentaires !
Section 4. Chapitre 3
Demandez à l'IA
Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion