white-space: nowrap;

ブラウザ
  • IE
  • Cr
  • Sf
  • Fx
  • O
プロパティ

white-space は、空白類文字(改行、半角スペース、タブ)の扱いを指定するプロパティです。

このプロパティ(値 nowrap)をtd要素th要素)に対して設定すると、セル内の自動的な折り返しを禁止することができます。


td.example {
white-space: nowrap;
}

プロパティ名 説明
white-space normal 標準 (初期値)
nowrap 自動的な折り返しを禁止する

このプロパティに関する詳細は、改行・スペース・タブの扱いを指定するをご覧ください。

使用例


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>文書のタイトル</title>

<style type="text/css">

table {
width: 250px;
border: 2px #2b2b2b solid;
}
td {
border: 2px #2b2b2b solid;
}

td.example {
white-space: nowrap;
}

</style>

</head>
<body>

<table>
<tr>
<td class="example">サンプルテキストサンプル</td>
<td>サンプルテキストサンプル</td>
</tr>
</table>

</body>
</html>

表示例
サンプルテキストサンプル サンプルテキストサンプル