Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Apprendre Code Markup in HTML | Advanced Text Formatting Elements
Introduction to HTML

book
Code Markup in HTML

You can use the <code> element to mark up code in HTML.

html

index.html

copy
<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:

html

index.html

copy
<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.

html

index.html

copy
<p>To save the file, press <kbd>Ctrl</kbd>+<kbd>S</kbd>.</p>

Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 4. Chapitre 3

Demandez à l'IA

expand
ChatGPT

Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion

some-alt