×

Pre-Formatted Text [14/17]

You've probably noticed already that the code looks different in HTML Editor and in the mini browser.

You can key in a long sequence of spaces in the HTML code, but the browser would display them as a single space. Similarly, you can make as many line breaks in the HTML code, but the browser would ignore them unless you use special tags like <p> or <br>.

To change such behaviour, you can use the <pre> tag denoting "pre-formatted text". The browser preserves and shows all spaces and line breaks put within the <pre> tag.

Most frequently, this tag is used to display code samples.


Do it
HTML
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Pre-Formatted Text</title> </head> <body> /\ \ __/\ \ /\ \ \ \ \/\ \ \ \ __\ \ \____ \ \ \ \ \ \ \ /'__`\ \ '__`\ \ \ \_/ \_\ \/\ __/\ \ \_\ \ \ `\___x___/\ \____\\ \_,__/ \ /__//__/ \/____/ \/___/ </body> </html>
CSS
HTML Academy
  1. Enclose all the text inside body in the pre tag.
Theory Check Next