White-space

Contact Us or call 1-877-932-8228
White-space

White-space

The white-space property determines how sequences of whitespace are displayed. The following table shows the values and their effects:

white-space Values
Property Collapses Series of Spaces and/or Tabs in Code Collapses Line Breaks in Code Wraps to Fit Containing Box
normal Yes Yes Yes
pre No No No
nowrap Yes Yes No

The following code sample shows the effects white-space:

Code Sample:

CssText/Demos/WhiteSpace.html
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<title>White-Space</title>
</head>
<body>

<h1>White-Space</h1>

<div style="white-space: normal;">
	white-space: normal
	white-space: normal
	white-space: normal white-space: normal white-space: normal white-space: normal 
	white-space: normal white-space: normal
</div>
<hr>
<div style="white-space: nowrap;">
	white-space: nowrap
	white-space: nowrap
	white-space: nowrap white-space: nowrap white-space: nowrap white-space: nowrap 
	white-space: nowrap white-space: nowrap
</div>
<hr>
<div style="white-space: pre;">
	white-space: pre
		white-space: pre
			white-space: pre
</div>

</body>
</html>

The above code will render the following:

Next