Move to the next line in html. Line break and separator line in HTML


Description

The white-space property specifies how to display spaces between words. Under normal circumstances, any number of spaces in HTML code appear as one on a web page. The exception is the tag

Text placed in this container is output with all spaces as it was formatted by the user.  So white-space imitates the way the tag works 
But unlike it, it does not change the font to monospace.

Syntax

white-space: normal | nowrap | pre | pre-line | pre-wrap | inherit

Values

normal The text in the browser window is displayed as usual, line breaks are set automatically. nowrap Spaces are not taken into account, line breaks in HTML code are ignored, all text is displayed on one line; at the same time, adding a tag
wraps the text on a new line. pre The text is shown taking into account all spaces and hyphens as they were added by the developer in the HTML code. If the line is too long and does not fit in the browser window, a horizontal scroll bar will be added. pre-line Spaces are not taken into account in the text; the text is automatically moved to the next line if it does not fit into the specified area. pre-wrap All spaces and breaks are preserved in the text, but if the width of the line does not fit into the specified area, the text will automatically be wrapped to the next line. inherit Inherits the value of the parent.

The effect of values ​​on text is presented in table. 1.

HTML5 CSS2.1 IE Cr Op Sa Fx

white-space

Example

Fermat's Last Theorem
X n+ Y n= Z n
where n is an integer > 2

The result of this example is shown in Fig. 1.

Rice. 1. Applying the white-space property

Object model

document.getElementById("elementID ").style.whiteSpace

Browsers

Internet Explorer versions up to and including 7.0 do not support pre-line , pre-wrap , or inherit values. For