We are independent & ad-supported. We may earn a commission for purchases made through our links.
Advertiser Disclosure
Our website is an independent, advertising-supported platform. We provide our content free of charge to our readers, and to keep it that way, we rely on revenue generated through advertisements and affiliate partnerships. This means that when you click on certain links on our site and make a purchase, we may earn a commission. Learn more.
How We Make Money
We sustain our operations through affiliate commissions and advertising. If you click on an affiliate link and make a purchase, we may receive a commission from the merchant at no additional cost to you. We also display advertisements on our website, which help generate revenue to support our work and keep our content free for readers. Our editorial team operates independently of our advertising and affiliate partnerships to ensure that our content remains unbiased and focused on providing you with the best information and recommendations based on thorough research and honest evaluations. To remain transparent, we’ve provided a list of our current affiliate partners here.
Software

Our Promise to you

Founded in 2002, our company has been a trusted resource for readers seeking informative and engaging content. Our dedication to quality remains unwavering—and will never change. We follow a strict editorial policy, ensuring that our content is authored by highly qualified professionals and edited by subject matter experts. This guarantees that everything we publish is objective, accurate, and trustworthy.

Over the years, we've refined our approach to cover a wide range of topics, providing readers with reliable and practical advice to enhance their knowledge and skills. That's why millions of readers turn to us each year. Join us in celebrating the joy of learning, guided by standards you can trust.

What Is an HTML Line Break?

By Eugene P.
Updated: May 16, 2024
Views: 17,711
References
Share

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.

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.

Share
EasyTechJunkie is dedicated to providing accurate and trustworthy information. We carefully select reputable sources and employ a rigorous fact-checking process to maintain the highest standards. To learn more about our commitment to accuracy, read our editorial process.
Link to Sources
Discussion Comments
Share
https://www.easytechjunkie.com/what-is-an-html-line-break.htm
Copy this link
EasyTechJunkie, in your inbox

Our latest articles, guides, and more, delivered daily.

EasyTechJunkie, in your inbox

Our latest articles, guides, and more, delivered daily.