Easy To Learning
  • Login
  • Sign Up
  • Q&A
  • Home
  • Php Tutorial
  • MySql Tutorial
  • Object-Oriented Programming
  • Java Tutorial
  • HTML Tutorial
  • React JS Tutorials
  • Free Projects
  • Blogs & Articles
  • Others
    • About Us
    • Contact Us
HTML Pre Tag
Easy To Learning

Education Needs Complete Solution

Online Ask Question Question And Answer
  1. Home
  2. HTML Tutorials
  3. HTML Pre Tag

HTML Tutorial

Basic HTML Fundamentals

  • HTML Table Content
  • Introduction To HTML
  • What Is HTML
  • HTML Tags
  • HTML Formatting
  • HTML Heading
  • HTML Paragraph
  • HTML Anchor
  • HTML Image
  • HTML Table
  • HTML Lists
  • HTML Ordered List
  • HTML Unordered List
  • HTML Description List
  • HTML Form

HTML Tags

  • Marquee HTML
  • HTML Textarea
  • HTML Quotes
  • HTML Style
  • HTML Title Or HTML Doctype
  • HTML Div Tag
  • HTML Pre Tag
  • HTML Code Tag
  • HTML Label Tag
  • HTML Input Tag
  • HTML Button Tag
  • HTML Hr Tag
  • HTML Br Tag
  • HTML Script Tag
  • HTML NoScript Tag
  • HTML Bold Tag

HTML Pre Tag

HTML pre tag

The HTML <pre> tag is used to specify pre formatted texts. Texts within <pre>.......</pre> tag is displayed in a fixed-width font. Usually it is displayed in Courier font. It maintains both space and line break.

It is widely used to display language examples e.g. Java, C#, C, C++ etc because it displays the code as it is typed.

HTML pre tag example

<pre>  
This is a formatted text   
by using the HTML pre tag. It maintains  
    both space and line break.  
</pre> 

Output

This is a formatted text   
by using the HTML pre tag. It maintains  
    both space and line break.  

HTML pre tag example: Java code within pre

<pre>  
package com.easytolearning;  
public class MyJava{  
public static void main(String args[]){  
System.out.println("hello java");  
}  
}  
</pre>

Output

package com.easytolearning;  
public class MyJava{  
public static void main(String args[]){  
System.out.println("hello java");  
}  
} 

Attributes

Attribute Value Description
width number Not supported in HTML5.
Specifies the maximum number of characters per line
Series: HTML Tutorials Hub
All Topics
Free Download Projects
Previous Chapter
Next Chapter

Ask a Question

Have a coding query or doubt? Ask here and get help from our community.

500 characters remaining
Submitting...
Free Download Projects
Join Telegram Group Join WhatsApp Group
Related Topics:
code tag pre tag in php html pre width preformatted meaning html pre tag wrap del tag in html pre tag not working pre tag in html easytolearning

Member Sign In

Forgot?
Signing in...

Don't have an account? Register here

Create Free Account

Register Captcha
Registering...

Already have an account? Sign In

Ask a Question

500 characters remaining
Submitting...

About Easy To Learning

Easy To Learning is a comprehensive programming learning portal offering free, practical, developer-driven tutorials for PHP, Java, Python, Spring, MySQL, CSS, Bootstrap, CakePHP, and more.

Explore community-contributed questions and answers, and download ready-to-run source code projects.

Quick Links

  • Home
  • Questions & Answers
  • Download Projects
  • Blog & Articles
  • Member Login

Community

  • Telegram Group
  • WhatsApp Community
  • Ask a Question
  • Join as Member

Connect With Us

Stay updated with our newest programming tutorials and free open source projects.

© 2026 Easy To Learning. All Rights Reserved.