HTML Code Tag

Code Tag in HTML

We use the code tag to define some computer code. The content within the tag is shown in the monospace font. Simply, we are defining some computer code().

Have a look at the below example, where we are trying to use the code tag →

<!DOCTYPE html>
<html lang=”en”>
<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>Some heading…</title>
<div>we use the <code>img</code> tag for adding images to our web pages…</div>

Now, if we try to open the file in the browser, we find that the text IMG has a different font. Have a look at the output –

So, whenever we need to define some computer-related code, we can use the code tag.