Web Development

HTML – Code Element to Highlight Codes

HTML <CODE> Element

If your pages include any programming code, scripting language code. Any codes on the webpage will be placed inside the <code> element.

The code element has ending tag </code>.

The <code> element is presented in a monospaced font, like the code in most of the programming language books.

HTML Code [With C Example]

<code>
#include<stdio.h> #include<conio.h> float carea(float); void main() { float radius; printf("Enter Radius:"); scanf("%f",&radius); carea(radius); getch(); } float carea(float radius) { float area; area=3.14159*radius*radius; printf("Area= %f",area); }
</code>

HTML Output

#include #include float carea(float); void main() { float radius; printf("Enter Radius:"); scanf("%f",&radius); carea(radius); getch(); } float carea(float radius) { float area; area=3.14159*radius*radius; printf("Area= %f",area); }

The <code> element is often used in conjunction with the <pre> element so that the formatting of the code is retained.

Tuts

About Author

Tutsmaster.org provides tutorials related to tech and programmings. We are also setting up a community for the users and students.

You may also like

HTML introduction
Web Development

HTML – Introduction, History & Syntax

  • December 21, 2019
So, first of all, I would like to ask a question for the first time when you heard this term
html heading tag
Web Development

HTML – Heading Tag With Syntax

  • December 21, 2019
A heading tag is one of the most important tags we focus on in HTML or web development because, without