HTML and CSS

word wrap css | How to word wrap text in HTML using CSS

The word-wrap css, line breaking or word wrapping property is the process of breaking a long word to be fit in the available width of a page or display area. It wraps the text onto the next line. The word-wrap property splits next line when it gets to the end of a page or text field. Using word-wrap property force long text to wrap in a new line by specifying break-word CSS. The word-wrap property is used to wrap the text to the next line.

CSS word-wrap property | Word-Wrap: Force Text to Wrap

word-wrap property
CSS word-wrap property
.wrap-text {
   word-wrap: break-word;
   white-space: nowrap;
}

<div class="wrap-text">The word-wrap, line breaking or word wrapping property is the process of breaking a long words to be fit in the available</div>

“word-break: break-all” – break the word

The word-wrap CSS property specifies the process of breaking a long word to be broken and wrap onto the next line. Default value: normal. Line breaking or word wrapping is the feature of continuing on a new line when a line is not fit in the same row or not fit in the viewable area, each line needs to fits in the viewable window, which can be read from without any horizontal scrolling.

The word-wrap property allows long words to be able to be broken and possible to wrap onto the next line. Word wrap makes it newline within paragraphs and allows the display of text within the window or other display area screen.

In HTML there is a tag that has the same purpose for line breaking for long words to be fits in the available width of a page by hard-code newline. The word-wrap property work with cross-browser support including IE in updated version 9+ above. The word wrapping is a simple method that puts as many words on a line as possible to the next line. Microsoft has introduced the word-wrap property which is added in CSS3 that can be supported in all the latest browsers. The word-wrap property specifies the process of breaking a long word to be fit in the available width of a page or display area.


Learn HTML/CSS from W3 School Website