HTML line break: use br tag

When formatting text , there is often a need to add a new paragraph, but without the empty line that the paragraph tag <p> inserts. In addition, sometimes it is necessary to preserve exactly the formatting of the previous text, which the <p> tag “categorically” cancels. Often you have to break one paragraph into several parts that are logically related.

For some fragments of text, standard spacing for paragraphs is simply inappropriate. These can be captions under pictures and tables, verses, quotes, footnotes and notes.

html tag br

For forced line wrapping, a special tag is provided, the function of which is in its name br (break row - "break a row, line"). The html hypertext markup language tag <br> means that all content following it should begin on a new line. If necessary, you can affix several tags in a row to achieve the required interval.

The <br> tag is not case sensitive and does not require a closing tag because it is an empty element, but it’s better to get used to closing all tags. In XHTML, the break tag must be "tightly closed" to the backslash.

Break tag example



<meta http-equiv = 'Content-Type'>

<META HTTP-EQUIV = 'Content-Type' CONTENT = 'text / html; windows-1251 '>

<title> br tag in action </ title>



<p> Absenteeism at the service </p>

<p> Nowhere else and never <br>

I have not been so bad <br>

Superiors greedy horde <br>

Nibbles me alive </ p>


Work absenteeism

Nowhere and never
I have not been so bad.
Authorities greedy horde
Gnawing me alive.

Tag Attribute <br>

The only attribute that the html <br> tag has is called Clear. It tells the browser what to do with the wrapped string if the text has to wrap around the so-called floating element, such as, for example, an image with the align attribute using the right / left values, or a block in CSS that has the float property set.

In the XHTML 1.0 / HTML 4.01 specifications, the clear attribute can only be used with Transitional, Frameset, and <! DOCTYPE>, otherwise the code will not work.

Tag Attribute Properties

The effect of using the clear attribute depends on its value and the location of the floating element streamlined by the text. The attribute can take 4 values:

<br clear = 'right | left | all | none '>

tag br

The value left prevents the flow around an element aligned to the left edge, so the text, "tripping" on the tag <br>, will be located below the image or other floating element.

Exactly this result will come from using the argument all, which will never allow the text to flow around the picture either on the right or on the left.

The value right prevents the text from flowing around the element aligned to the right, so after the <br> tag there will be nothing left for the text but to bypass the image, flowing around it to the right.

A value of none ("neither yours nor ours") generally removes all permissions from the clear attribute, and the <br> tag silently wraps the line down.

As a default, the clear attribute of the tag is missing.

Tag <br> is a soft carry

The line break tag is very convenient for creating the necessary intervals between paragraphs, inside which it is used as a soft hyphen, but not as a means for dividing text into paragraphs.

html hypertext markup br tag means

You should not get too carried away with the line feed tag to format text, because the results of its application are not always distinguished by elegance.

For example, if you use the <br> tag to translate lines within a paragraph, this can lead to the appearance of a “comb” in the user’s window if it is smaller than the window that the webmaster focused on.


All Articles