3.7. Controlling Line Breaks

When displaying most types of text, the browser inserts line breaks to fit the available space. In Section 2.2 (Basic Text Elements), you saw the PRE tag that set a fixed-width font and turned off word wrapping for an entire paragraph. In addition to PRE, HTML lets you insert explicit line breaks with the BR tag and prevent line breaks by the use of either nonbreaking spaces or the nonstandard, but widely supported, NOBR tag.

HTML Element: <BR ...> (No End Tag)
Attributes: CLEAR

BR inserts a line break without ending the current paragraph. Because carriage returns in the HTML source are ignored except within a few special elements such as PRE or TEXTAREA, BR is necessary to guarantee a line break in the resultant ...

Get Core Web Programming, Second 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.