What is a <code> tag?
Experience Level: Junior
Tags: HTML
Answer
The <code>
element is used to define enclosed text as computer code. It is often paired with the <pre>
element to preserve line breaks and indentation when presenting blocks of computer code.
<html>
<head>
<title>Tag pre</title>
</head>
<body>
<figure>
<figcaption>Code pre</figcaption>
<pre>
<code>
Code
</code>
</pre>
</figure>
</body>
</html>
Related HTML job interview questions
What is a <form> tag?
HTML JuniorWhat is a <pre> tag?
HTML JuniorWhat is a <body> tag?
HTML JuniorWhat is a <html> tag?
HTML JuniorWhat are <h1>...<h6> tags?
HTML Junior