Publishers of technology books, eBooks, and videos for creative people

Home > Articles > Web Design & Development > HTML/XHTML

  • Print
  • + Share This
This chapter is from the book

Creating a Line Break

Browsers automatically wrap text according to the width of the block or window, creating new lines as necessary. While you can start a new paragraph with the p tag (see page 62), you can also create manual line breaks anywhere you like.

The br tag is perfect for poems or other short lines of text that should appear one after another without a lot of space in between.

To insert a line break:

Type <br /> where the line break should occur. There is no separate closing br tag.

Figure 3.20

Figure 3.20 I've created a new division at the top of the page that can serve as a table of contents. There will be three lines (thanks to the br tag) with the minimum amount of space between each one.

Figure 3.21

Figure 3.21 Remember that the returns in your code are always ignored. This code is equivalent to that shown above in Figure 3.20 though it's easier to read.

Figure 3.22

Figure 3.22 The br element starts the subsequent elements on a new line.

  • + Share This
  • 🔖 Save To Your Account