要素内の空白文字の処理方法を指定するプロパティです。normal、nowrap、pre、pre-wrapなどがあり、改行やスペースの扱いを制御します。コードブロックの表示やテキストの折り返し制御に重要です。
white-space: normal | nowrap | pre | pre-wrap | pre-line | break-spaceswhite-space: nowrap;テキストを改行させない
white-space: pre-wrap;空白を保持しつつ自動改行
.code {
white-space: pre;
font-family: monospace;
}コードブロックの整形
nowrapは一行表示、pre-wrapはコードの表示に便利。
全ブラウザ対応