Category: 

What Is an HTML Line Break?

Article Details
  • Written By: Eugene P.
  • Edited By: Angela B.
  • Last Modified Date: 26 July 2014
  • Copyright Protected:
    2003-2014
    Conjecture Corporation
  • Print this Article
Free Widgets for your Site/Blog
Bill Clinton met John F. Kennedy when he was 16.  more...

September 2 ,  1666 :  The "Great Fire of London" burned down more than 13,000 buildings, including St. Paul's   more...

In the HyperText Markup Language (HTML), a line break is a tag or cascading style sheet (CSS) property that causes the HTML viewer or web browser to immediately drop down to the next available line and draw the next element, starting at the defined margin. There are two generally accepted ways to insert an HTML line break into a document. The first is to use the break (BR) tag, forcing the browser to start the next elements on the next line, aligned to the left border. The other option is to use different CSS properties to define borders, gutters or spacing around block-level elements to create open space, although this method does not affect word wrapping in a document.

One of the design principles of HTML is that the browser is usually allowed to have some control over the layout of web pages. This allows well-designed sites to have a very fluid appearance, regardless of the size of the display. When a paragraph is drawn, the browser is usually charged with finding the proper place to end a line, usually at the right margin of a block. Using an implicit HTML line break interrupts this process.

Ad

The BR tag is the simplest way to end a line and move down. Use of the tag is generally accepted for some minor formatting, although its use is frowned on as the sole way of defining paragraphs in a document. The paragraph tag is preferred for separating areas of text, because it creates a block that can manipulated with CSS or other tags, while the HTML line break tag stands alone and does not enclose a block. The break tag can be used within a paragraph block, largely to prevent the browser from using two breaks between paragraphs, which is the default behavior.

Another method used to cause a line break is to increase the size of a box of text with CSS properties. This effectively extends the bottom of a container so blank space is left after it. This can appear the same as using a break or paragraph tag, except the text within the container is not modified, so word wrapping is still largely controlled by the browser.

One area in which an HTML line break might need to be specified is when text is wrapping around an inline image. An easy way to create cleanly formatted paragraphs that sit to the side of an image is to use the CLEAR modifier for the HTML line break tag. This allows specification for whether a line break should continue as normal or jump to the next available line after an image. It also is possible to create CSS styles that will mimic this behavior, although it might not be as fluid under certain circumstances.

Ad

More from Wisegeek

You might also Like

Discuss this Article

Post your comments

Post Anonymously

Login

username
password
forgot password?

Register

username
password
confirm
email