What is the purpose of the white-space property?

Subh Prakash Singh
Invent the Future
The white-space property in CSS defines how spaces and line breaks within an element are managed. It specifies whether text should wrap to the next line, whether extra spaces are collapsed, or if they should be preserved as is. Example: p { white-space: nowrap; /* Restricts text to a single line, preventing any automatic wrapping */ } There are important Properties of white-space: normal (default): Extra spaces are collapsed, and text wraps automatically. nowrap: Ensures all text remains on a single line, preventing any automatic line breaks. pre: Retains spaces and line breaks exactly as they appear in the HTML, without any alterations. pre-wrap: Maintains spaces while allowing text to wrap when needed. pre-line: Collapses spaces but retains line breaks.