The Complete WebDeveloper (42 Blogs) Become a Certified Professional

Know How to implement pre tag in HTML

Published on Aug 27,2019 20 Views

MI-new-launch

myMock Interview Service for Real Tech Jobs

myMock-mobile-banner-bg

myMock Interview Service for Real Tech Jobs

  • Mock interview in latest tech domains i.e JAVA, AI, DEVOPS,etc
  • Get interviewed by leading tech experts
  • Real time assessment report and video recording

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.

html-spanIn 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:

  • Width

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:

pre tag in html

 

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:

example of pre tag

 

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.

Check out our Full Stack Web Developer Masters Program 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.

Comments
0 Comments

Browse Categories

webinar REGISTER FOR FREE WEBINAR
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP

Subscribe to our Newsletter, and get personalized recommendations.