Saturday, April 19, 2025

HTML Preformated Text

To define preformatted text in HTML we will use pre tag. Preformatted html element is useful when we need to preserve how that text, or source code in some programming language look alike.

With pre element we will preserve original spaces and line breaks.

While preserving source code of some programming language that uses arrows as part of instruction, those arrows must be replaced with their HTML equivalent.

That's common mistake for a lot of beginners.

Inside preformatted element we  can have other tags, as code for computer code representation, samp for sample of program output, kbd as keyboard input and var for stating variables.

For the most part, simple code section into pre section will get the job done. 

Please, pay strict attention about left and right arrows while inserting, for example, C++ source code inside web page.

You are strongly advised to watch YT video below this example, on WebDevPro channel.

	#include <iostream>

	using namespace std;

	int main() {

		cout  << "Our custom string to print" << endl;
		return 0;

	}		

No comments:

Post a Comment

Tkinter Introduction - Top Widget, Method, Button

First, let's make shure that our tkinter module is working ok with simple  for loop that will spawn 5 instances of blank Tk window .  ...