HTML break line
When you create an HTML document, you may want to move the line within the paragraph: for example, when you place a fragment from a poem, each phrase must start with a new line.
Note that you will not be able to change the appearance of text on the page by adding extra spaces or line breaks to your code. Any number of spaces and line breaks will be counted as a single space, because the browser will automatically delete all the extra spaces and line breaks, in which case the browser displays a poem excerpt as a single sentence:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Page title</title> </head> <body> <p> The autumn looked into the garden The birds flew away. Outside the window in the morning rustle Yellow snowstorms. </p> <p>Notice that the browser ignores your text formatting</p> </body> </html>Try it »
In such cases, the best way out of the situation would be to use the
<br> tag. HTML
<br> tag breaks the flow of text and inserts a line break, which means that all the content after it is displayed on a new line. This is useful when formatting text that requires fixed line breaks, such as to write an address or lyrics.
It is one of the empty elements that have no content. Empty tags, such as
<br>, initially have no content, so use a short description was invented to represent the element, that is, where you want to add a line break, simply substitute the
<br> tag. A short description implies that this tag does not have a closing tag. If there was no short description, would have had each time to mark the line break write
</br>, and would it be more convenient?!
Note that the short description is invented and used not because of laziness, but to improve efficiency by easier reading of the code. And in fact, after some time spent reading the HTML code, you will see that such elements are more easily perceived and memorized.
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Page title</title> </head> <body> <p>This is a normal<br> paragraph with a li-<br>ne break</p> </body> </html>Try it »
To wrap text on multiple lines, the
<br> tag is set to the appropriate number of times.