How to wrap words in css that don't fit in a block? How to add a line break using CSS properties Force a line break in html.

Description

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

Text placed in this container is displayed with all spaces as it was formatted by the user.  So white-space mimics how 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 ignored, line breaks in HTML code are ignored, all text is displayed on one line; however, adding the tag
wraps text on a new line. pre The text is shown including all spaces and hyphens as they were added by the developer in the HTML code. If the line is too long to 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 wrapped to the next line if it does not fit in the specified area. pre-wrap All spaces and hyphens are preserved in the text, but if the width of the line does not fit into the specified area, then the text will automatically wrap to the next line. inherit Inherits the value of the parent.

The effect of values ​​on the text is presented in Table. one.

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. one.

Rice. 1. Applying the white-space property

Object Model

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

Browsers

Browser internet explorer up to version 7.0 does not support pre-line , pre-wrap , and inherit values. For