3.2. Manual Line Breaks
Occasionally, you need to break a text line prematurely (that is, before the paragraph break). In such cases, use the line break tag (<br />).
Use of Line Break TagsFor an example of how line breaks are used, consider these lines from William Shakespeare's play Hamlet: Fran. I think I hear them.--Stand, ho! Who is there? [Enter Horatio and Marcellus.] Hor. Friends to this ground. Mar. And liegemen to the Dane. Fran. Give you good-night. Mar. O, farewell, honest soldier; Who hath reliev'd you? This text has the distinct format of a play script where each paragraph is formatted like the following example: Actor Dialog For example, dialog for Fran would resemble the following: Fran. Give you good-night. Source To format text such as in the preceding example, you make each actor-dialog pair a separate paragraph with a line break between the two: <p>Fran.<br/> I think I hear them.--Stand, ho! Who is there?</p> <p>[Enter Horatio and Marcellus.]</p> <p>Hor.<br /> Friends to this ground.</p> <p>Mar.<br /> And liegemen to the Dane.</p> <p>Fran.<br /> Give you good-night.</p> <p>Mar.<br /> O, farewell, honest soldier;<br />Who hath reliev'd you?</p>
Output |
Get Web Standards Programmer's Reference: HTML, CSS, JavaScript®, Perl, Python®, and PHP 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.