Know How to implement pre tag in HTML

Last updated on Jun 10,2024 964 Views

Know How to implement pre tag in HTML

edureka.co

The <pre> tag in HTML is used for identifying preformatted text. The code tag is surrounded by the code being marked up. Let’s understand this

 

What is the use of pre tag in HTML?

In your web browsers usually render pretext in a fixed-pitched font, with the whitespace intact, and without the word wrap.

In this, the pre tag will allow the same space and the font with respect to the user entered. The below mentioned is the specific attributes in which the pre tag in HTML will support in the table mentioned.

 

Specific Attributes and Browser Support

This HTML <pre> tag will also support the following additional attributes:

Value: Number

Description: This one specifies the required width of the pre-formatted content.

 

Browser Supports

Here listing out all the browsers which are supporting. It’s given it the table mentioned below. So if you have any of these it will support.

ChromeIE OperaSafariAndroidFirefox
YESYESYESYESYESYES

 

Examples of <pre> tag

Example 1:

<!DOCTYPE html>
<html>
		<head>
			<title> pre tag in HTML</title>
		</head>
		<body>
		

<pre>
			This is the content     writing
			    for the HTML     pre tag.
		Includes the          code  here.
		</body>
</html>

Output:

 

Example 2:

<!DOCTYPE html>
<html>
		<head>
			<title> pre tag in HTML</title>
		</head>
		<body>
		
<pre>
			I'm working for           edureka
			Writing         blogs     on the        programming 
			                 language
		</body>
</html>

Output:

 

With this, we come to an end of this article on pre tag in HTML. I hope you got an idea on how to preformat a text in HTML with these examples. DO check our other blogs on HTML.

Transform your designs and boost your career with our UI UX Design Course.

Check out our Full Stack Web Development Course which comes with instructor-led live training and real-life project experience. This training makes you proficient in skills to work with back-end and front-end web technologies. It includes training on Web Development, jQuery, Angular, NodeJS, ExpressJS, and MongoDB.

Check out the Angular Online Course by Edureka, a trusted online learning company with a network of more than 250,000 satisfied learners spread across the globe. Angular is a JavaScript framework that is used to create scalable, enterprise, and performance client-side web applications. With Angular framework adoption being high, performance management of the application is community-driven, indirectly driving better job opportunities.

BROWSE COURSES