Simple HTML Text Formatting

When you want text to appear on the browser's screen, you enter the text inside the HTML code. Your Web page body could simply include lines of text like this:

<body>
This text will appear
on whatever Web browser screen
opens this HTML code.
</body>

Web browsers do not automatically format text. These three lines of text all appear on one line inside the browser, like this:

This text will appear on whatever Web browser screen opens this HTML code.

If you want to add line breaks, you must include the <br> tag (no ending <br> tag exists). <br> tells the Web browser to break the line at that point and move to the next line. The following <body> section displays three lines of text:

 <body> This text will appear<br> ...

Get Absolute Beginner's Guide to Programming, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.